| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

Public Member Functions | Private Attributes

# StreamLogger Class Reference

`#include <StreamLogger.h>`

Collaboration diagram for StreamLogger:
[legend]

List of all members.

## Public Member Functions
| StreamLogger (const std::string &file)
| StreamLogger (std::ostream &ost)
| StreamLogger (IMessageSvc *, MSG::Level)
| ~StreamLogger ()
std::string | name () const
void | WriteToStream (const std::string &str)
void | WriteToMsgSvc (const std::string &str)
## Private Attributes
bool | m_isMine
std::ostream * | p_ost
MsgStream * | p_msgStr
MSG::Level | m_level
std::string | m_name

## Detailed Description

Definition at line 11 of file StreamLogger.h.

## Constructor & Destructor Documentation

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

Definition at line 10 of file StreamLogger.cpp.

                                                   : m_isMine(1),
                                                         p_ost(0), p_msgStr(0) {
      m_name = "file:" + file;
      p_ost = new std::ofstream(file.c_str());
      if (p_ost == 0) {
        throw std::invalid_argument("can't open file");
      }
    }

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

Definition at line 26 of file StreamLogger.cpp.

                                             : m_isMine(0) , p_ost(0),
                                                   p_msgStr(0){
      p_ost = &ost;
      if (ost == std::cerr) {
        m_name = "STDERR";
      } else if ( ost == std::cout) {
        m_name = "STDOUT";
      } else {
        m_name = "unknown ostream";
      }
    }

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

Definition at line 19 of file StreamLogger.cpp.

                                                            :
      m_isMine(1), p_ost(0), p_msgStr(0) {
      p_msgStr = new MsgStream( svc, "IssueLogger");
      m_level = lev;
      m_name = "MsgStream";
    }

StreamLogger::~StreamLogger | ( | ) |

Definition at line 43 of file StreamLogger.cpp.

                                {
      if (m_isMine && p_ost != 0) {
        delete p_ost;
      }
      if (p_msgStr != 0) {
        delete p_msgStr;
      }
    }

## Member Function Documentation

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

Definition at line 39 of file StreamLogger.cpp.

                             {
      return m_name;
    }

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

Definition at line 22 of file StreamLogger.h.

                                               { *p_msgStr << m_level << str
                                                             << endmsg; }

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

Definition at line 21 of file StreamLogger.h.

    { *p_ost << str << std::endl; }

## Member Data Documentation

bool StreamLogger::m_isMine`[private]`

Definition at line 27 of file StreamLogger.h.

MSG::Level StreamLogger::m_level`[private]`

Definition at line 30 of file StreamLogger.h.

std::string StreamLogger::m_name`[private]`

Definition at line 31 of file StreamLogger.h.

MsgStream* StreamLogger::p_msgStr`[private]`

Definition at line 29 of file StreamLogger.h.

std::ostream* StreamLogger::p_ost`[private]`

Definition at line 28 of file StreamLogger.h.

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

- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r2/GaudiSvc/src/IssueLogger/StreamLogger.h
- /afs/.cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r2/GaudiSvc/src/IssueLogger/StreamLogger.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines