| # Gaudi Framework, version v21r11 |

Home |  | Generated: 30 Sep 2010

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

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

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

Definition at line 26 of file StreamLogger.cpp.

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

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

Definition at line 19 of file StreamLogger.cpp.

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

StreamLogger::~StreamLogger | ( |  | ) |

Definition at line 43 of file StreamLogger.cpp.

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

## Member Function Documentation

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

Definition at line 39 of file StreamLogger.cpp.

    00039                          {
    00040   return m_name;
    00041 }

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

Definition at line 21 of file StreamLogger.h.

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

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

Definition at line 22 of file StreamLogger.h.

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

## Member Data Documentation

bool StreamLogger::m_isMine`[private]`

Definition at line 27 of file StreamLogger.h.

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

Definition at line 28 of file StreamLogger.h.

MsgStream* StreamLogger::p_msgStr`[private]`

Definition at line 29 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.

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

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