| The Gaudi Framework v28r2p1 (f1a77ff4)

- 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 public:
13 StreamLogger(const std::string& file);
14 StreamLogger(std::ostream &ost);
15 StreamLogger(IMessageSvc*, MSG::Level);
16
17 const std::string& name() const { return m_name; }
18
19 void WriteToStream(const std::string& str) { *m_ost << str << std::endl; }
20 void WriteToMsgSvc(const std::string& str) { *m_msgStr << m_level << str << endmsg; }
21
22 private:
23 std::string m_name;
24 std::unique_ptr<std::ostream> m_oost;
25 std::ostream* m_ost = nullptr;
26 std::unique_ptr<MsgStream> m_msgStr;
27 MSG::Level m_level = MSG::NIL;
28 };
29
30 #endif
StreamLogger
Definition: StreamLogger.h:11
StreamLogger::m_msgStr
std::unique_ptr< MsgStream > m_msgStr
Definition: StreamLogger.h:26
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:17
StreamLogger::m_name
std::string m_name
Definition: StreamLogger.h:23
std::string
STL class.
MSG::Level
Level
Definition: IMessageSvc.h:15
IMessageSvc
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
MSG::NIL
Definition: IMessageSvc.h:16
std::unique_ptr< std::ostream >
StreamLogger::WriteToMsgSvc
void WriteToMsgSvc(const std::string &str)
Definition: StreamLogger.h:20
StreamLogger::m_oost
std::unique_ptr< std::ostream > m_oost
Definition: StreamLogger.h:24
std::ostream
STL class.
StreamLogger::WriteToStream
void WriteToStream(const std::string &str)
Definition: StreamLogger.h:19
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StreamLogger::m_level
MSG::Level m_level
Definition: StreamLogger.h:27
StreamLogger::m_ost
std::ostream * m_ost
Definition: StreamLogger.h:25