ATLAS Offline Software
Loading...
Searching...
No Matches
LogFileMsgStream Class Reference

#include <LogFileMsgStream.h>

Inheritance diagram for LogFileMsgStream:
Collaboration diagram for LogFileMsgStream:

Public Member Functions

 LogFileMsgStream (IMessageSvc *svc, const std::string &source, const std::string &filename, bool startlogging)
 ~LogFileMsgStream ()
LogFileMsgStreamoperator<< (MSG::Level level)
 Accept MsgStream activation using MsgStreamer operator.
template<class T>
MsgStream & operator<< (const T &arg)
 General templated stream operator.
MsgStream & doOutput ()
void setFormat (const std::string &str)

Private Member Functions

 LogFileMsgStream ()

Private Attributes

std::ofstream m_logfile
std::string m_FormatString

Detailed Description

Definition at line 24 of file LogFileMsgStream.h.

Constructor & Destructor Documentation

◆ LogFileMsgStream() [1/2]

LogFileMsgStream::LogFileMsgStream ( IMessageSvc * svc,
const std::string & source,
const std::string & filename,
bool startlogging )
inline

Definition at line 27 of file LogFileMsgStream.h.

30 :
31 MsgStream(svc, source), m_FormatString("")
32 {
33 if(startlogging)
34 m_logfile.open(filename.c_str(),
35 std::ofstream::out | std::ofstream::app);
36 };
std::string m_FormatString
std::ofstream m_logfile

◆ ~LogFileMsgStream()

LogFileMsgStream::~LogFileMsgStream ( )
inline

Definition at line 39 of file LogFileMsgStream.h.

39 {
40 if(m_logfile.is_open())
41 m_logfile.close();
42 };

◆ LogFileMsgStream() [2/2]

LogFileMsgStream::LogFileMsgStream ( )
private

Member Function Documentation

◆ doOutput()

MsgStream & LogFileMsgStream::doOutput ( )
inline

Definition at line 62 of file LogFileMsgStream.h.

62 {
63 Message msg(m_source,m_currLevel,m_stream.str());
64 if(m_FormatString!="")
65 msg.setFormat(m_FormatString);
66 if(m_logfile.is_open())
67 m_logfile << msg << "\n";
68 return MsgStream::doOutput();
69 }
Message
Definition run.py:57
MsgStream & msg
Definition testRead.cxx:32

◆ operator<<() [1/2]

template<class T>
MsgStream & LogFileMsgStream::operator<< ( const T & arg)
inline

General templated stream operator.

Definition at line 55 of file LogFileMsgStream.h.

55 {
56 if(isActive()) m_stream << arg;
57 return *this;
58 }

◆ operator<<() [2/2]

LogFileMsgStream & LogFileMsgStream::operator<< ( MSG::Level level)
inline

Accept MsgStream activation using MsgStreamer operator.

Definition at line 46 of file LogFileMsgStream.h.

46 {
47 return (LogFileMsgStream&)MsgStream::report(level);
48 }
LogFileMsgStream(IMessageSvc *svc, const std::string &source, const std::string &filename, bool startlogging)

◆ setFormat()

void LogFileMsgStream::setFormat ( const std::string & str)
inline

Member Data Documentation

◆ m_FormatString

std::string LogFileMsgStream::m_FormatString
private

Definition at line 81 of file LogFileMsgStream.h.

◆ m_logfile

std::ofstream LogFileMsgStream::m_logfile
private

Definition at line 79 of file LogFileMsgStream.h.


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