| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# StreamLogger Class Reference

`#include <StreamLogger.h>`

Collaboration diagram for StreamLogger:

[legend]
List of all members.

## Detailed Description

Definition at line 11 of file StreamLogger.h.

## 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

## Constructor & Destructor Documentation

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

Definition at line 11 of file StreamLogger.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::c_str(), m_name, and p_ost.

    00011                                                : m_isMine(1),
    00012                                                      p_ost(0), p_msgStr(0) {
    00013   m_name = "file:" + file;
    00014   p_ost = new std::ofstream(file.c_str());
    00015   if (p_ost == 0) {
    00016     throw std::invalid_argument("can't open file");
    00017   }
    00018 }

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

Definition at line 27 of file StreamLogger.cpp.

References std::cerr, std::cout, m_name, and p_ost.

    00027                                          : m_isMine(0) , p_ost(0),
    00028                                                p_msgStr(0){
    00029   p_ost = &ost;
    00030   if (ost == std::cerr) {
    00031     m_name = "STDERR";
    00032   } else if ( ost == std::cout) {
    00033     m_name = "STDOUT";
    00034   } else {
    00035     m_name = "unknown ostream";
    00036   }
    00037 }

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

Definition at line 20 of file StreamLogger.cpp.

References m_level, m_name, and p_msgStr.

    00020                                                         :
    00021   m_isMine(1), p_ost(0), p_msgStr(0) {
    00022   p_msgStr = new MsgStream( svc, "IssueLogger");
    00023   m_level = lev;
    00024   m_name = "MsgStream";
    00025 }

StreamLogger::~StreamLogger | ( |  | ) |

Definition at line 44 of file StreamLogger.cpp.

References m_isMine, p_msgStr, and p_ost.

    00044                             {
    00045   if (m_isMine && p_ost != 0) {
    00046     delete p_ost;
    00047   }
    00048   if (p_msgStr != 0) {
    00049     delete p_msgStr;
    00050   }
    00051 }

## Member Function Documentation

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

Definition at line 40 of file StreamLogger.cpp.

References m_name.

Referenced by IssueLogger::connect(), and IssueLogger::setupDefaultLogger().

    00040                          {
    00041   return m_name;
    00042 }

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

Definition at line 21 of file StreamLogger.h.

References std::endl(), and p_ost.

Referenced by IssueLogger::connect().

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

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

Definition at line 22 of file StreamLogger.h.

References endreq(), m_level, and p_msgStr.

Referenced by IssueLogger::connect(), and IssueLogger::setupDefaultLogger().

    00022                                            { *p_msgStr << m_level << str
    00023                                                          << endreq; }

## Member Data Documentation

bool StreamLogger::m_isMine`[private]`

Definition at line 27 of file StreamLogger.h.

Referenced by ~StreamLogger().

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

Definition at line 28 of file StreamLogger.h.

Referenced by StreamLogger(), WriteToStream(), and ~StreamLogger().

MsgStream* StreamLogger::p_msgStr`[private]`

Definition at line 29 of file StreamLogger.h.

Referenced by StreamLogger(), WriteToMsgSvc(), and ~StreamLogger().

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

Definition at line 30 of file StreamLogger.h.

Referenced by StreamLogger(), and WriteToMsgSvc().

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

Definition at line 31 of file StreamLogger.h.

Referenced by name(), and StreamLogger().

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

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