| The Gaudi Framework v27r1

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Attributes | List of all members
StreamLogger Class Referencefinal

`#include <src/StreamLogger.h>`

Collaboration diagram for StreamLogger:
[legend]

## Public Member Functions
| StreamLogger (const std::string &file)
| StreamLogger (std::ostream &ost)
| StreamLogger (IMessageSvc *, MSG::Level)
const std::string & | name () const
void | WriteToStream (const std::string &str)
void | WriteToMsgSvc (const std::string &str)

## Private Attributes
std::string | m_name
std::unique_ptr< std::ostream > | m_oost
std::ostream * | m_ost = nullptr
std::unique_ptr< MsgStream > | m_msgStr
MSG::Level | m_level = MSG::NIL

## Detailed Description

Definition at line 11 of file StreamLogger.h.

## Constructor & Destructor Documentation

StreamLogger::StreamLogger | ( | const std::string & | file | ) |

Definition at line 4 of file StreamLogger.cpp.

5 : m_name{ "file:" + file },
6 m_oost{ new std::ofstream(file) }, m_ost{ m_oost.get() }
7 {
8 if (!m_oost) throw std::invalid_argument("can't open file");
9 }
StreamLogger::m_name
std::string m_name
Definition: StreamLogger.h:23
std::ofstream
STL class.
std::unique_ptr::get
T get(T...args)
StreamLogger::m_oost
std::unique_ptr< std::ostream > m_oost
Definition: StreamLogger.h:24
std::invalid_argument
STL class.
StreamLogger::m_ost
std::ostream * m_ost
Definition: StreamLogger.h:25

StreamLogger::StreamLogger | ( | std::ostream & | ost | ) |

Definition at line 17 of file StreamLogger.cpp.

17 :
18 m_name{ &ost == &std::cerr ? "STDERR" :
19 &ost == &std::cout ? "STDOUT" :
20 "unknown ostream" },
21 m_ost{ &ost }
22 { }
StreamLogger::m_name
std::string m_name
Definition: StreamLogger.h:23
std::cerr
StreamLogger::m_ost
std::ostream * m_ost
Definition: StreamLogger.h:25

StreamLogger::StreamLogger | ( | IMessageSvc * | svc,
|  | MSG::Level | lev
| ) |  |

Definition at line 11 of file StreamLogger.cpp.

11 :
12 m_name{ "MsgStream" },
13 m_msgStr{ new MsgStream( svc, "IssueLogger") },
14 m_level{ lev }
15 { }
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StreamLogger::m_msgStr
std::unique_ptr< MsgStream > m_msgStr
Definition: StreamLogger.h:26
StreamLogger::m_name
std::string m_name
Definition: StreamLogger.h:23
StreamLogger::m_level
MSG::Level m_level
Definition: StreamLogger.h:27

## Member Function Documentation

const std::string& StreamLogger::name | ( |  | ) | const
| inline

Definition at line 17 of file StreamLogger.h.

17 { return m_name; }
StreamLogger::m_name
std::string m_name
Definition: StreamLogger.h:23

void StreamLogger::WriteToMsgSvc | ( | const std::string & | str | ) |
| inline

Definition at line 20 of file StreamLogger.h.

20 { *m_msgStr << m_level << str << endmsg; }
StreamLogger::m_msgStr
std::unique_ptr< MsgStream > m_msgStr
Definition: StreamLogger.h:26
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

void StreamLogger::WriteToStream | ( | const std::string & | str | ) |
| inline

Definition at line 19 of file StreamLogger.h.

19 { *m_ost << str << std::endl; }
std::endl
T endl(T...args)
StreamLogger::m_ost
std::ostream * m_ost
Definition: StreamLogger.h:25

## Member Data Documentation

MSG::Level StreamLogger::m_level = MSG::NIL
| private

Definition at line 27 of file StreamLogger.h.

std::unique_ptr<MsgStream> StreamLogger::m_msgStr
| private

Definition at line 26 of file StreamLogger.h.

std::string StreamLogger::m_name
| private

Definition at line 23 of file StreamLogger.h.

std::unique_ptr<std::ostream> StreamLogger::m_oost
| private

Definition at line 24 of file StreamLogger.h.

std::ostream* StreamLogger::m_ost = nullptr
| private

Definition at line 25 of file StreamLogger.h.

The documentation for this class was generated from the following files:

- GaudiMonitor/src/StreamLogger.h
- GaudiMonitor/src/StreamLogger.cpp