| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

StreamLogger.h
Go to the documentation of this file.
1 #ifndef GAUDISVC_STREAMLOGGER_H
2 #define GAUDISVC_STREAMLOGGER_H
3
4 #include "GaudiKernel/MsgStream.h"
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 );
16 StreamLogger( IMessageSvc*, MSG::Level );
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:
24 std::string m_name;
25 std::unique_ptr<std::ostream> m_oost;
26 std::ostream* m_ost = nullptr;
27 std::unique_ptr<MsgStream> m_msgStr;
28 MSG::Level m_level = MSG::NIL;
29 };
30
31 #endif
StreamLogger
Definition: StreamLogger.h:11
StreamLogger::m_msgStr
std::unique_ptr< MsgStream > m_msgStr
Definition: StreamLogger.h:27
MsgStream.h
std::endl
T endl(T...args)
StreamLogger::StreamLogger
StreamLogger(const std::string &file)
Definition: StreamLogger.cpp:4
StreamLogger::name
const std::string & name() const
Definition: StreamLogger.h:18
StreamLogger::m_name
std::string m_name
Definition: StreamLogger.h:24
std::string
STL class.
MSG::Level
Level
Definition: IMessageSvc.h:16
IMessageSvc
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:38
MSG::NIL
Definition: IMessageSvc.h:16
std::unique_ptr< std::ostream >
StreamLogger::WriteToMsgSvc
void WriteToMsgSvc(const std::string &str)
Definition: StreamLogger.h:21
StreamLogger::m_oost
std::unique_ptr< std::ostream > m_oost
Definition: StreamLogger.h:25
std::ostream
STL class.
StreamLogger::WriteToStream
void WriteToStream(const std::string &str)
Definition: StreamLogger.h:20
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StreamLogger::m_level
MSG::Level m_level
Definition: StreamLogger.h:28
StreamLogger::m_ost
std::ostream * m_ost
Definition: StreamLogger.h:26