The Gaudi Framework  v29r0 (ff2e7097)
StreamLogger.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_STREAMLOGGER_H
2 #define GAUDISVC_STREAMLOGGER_H
3 
5 
6 #include <ostream>
7 #include <string>
8 
9 class IMessageSvc;
10 
11 class StreamLogger final
12 {
13 public:
14  StreamLogger( const std::string& file );
15  StreamLogger( std::ostream& ost );
17 
18  const std::string& name() const { return m_name; }
19 
20  void WriteToStream( const std::string& str ) { *m_ost << str << std::endl; }
21  void WriteToMsgSvc( const std::string& str ) { *m_msgStr << m_level << str << endmsg; }
22 
23 private:
26  std::ostream* m_ost = nullptr;
29 };
30 
31 #endif
std::unique_ptr< MsgStream > m_msgStr
Definition: StreamLogger.h:27
T endl(T...args)
StreamLogger(const std::string &file)
Definition: StreamLogger.cpp:4
const std::string & name() const
Definition: StreamLogger.h:18
std::string m_name
Definition: StreamLogger.h:24
STL class.
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:38
void WriteToMsgSvc(const std::string &str)
Definition: StreamLogger.h:21
std::unique_ptr< std::ostream > m_oost
Definition: StreamLogger.h:25
STL class.
void WriteToStream(const std::string &str)
Definition: StreamLogger.h:20
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
MSG::Level m_level
Definition: StreamLogger.h:28
std::ostream * m_ost
Definition: StreamLogger.h:26