CLAW Library (a C++ Library Absolutely Wonderful) 1.5.5
Public Member Functions | Private Attributes

claw::file_logger Class Reference

This class write log messages in a file. More...

#include <log_stream.hpp>

Inheritance diagram for claw::file_logger:
claw::log_stream claw::pattern::non_copyable

List of all members.

Public Member Functions

 file_logger (const std::string &filename)
 Constructor.
virtual ~file_logger ()
 Destructor.
virtual void write (const std::string &str)
 Write a string in the file.
virtual void flush ()
 Flush the stream.

Private Attributes

std::ofstream * m_file
 The file in which we write the messages.

Detailed Description

This class write log messages in a file.

Author:
Julien Jorge

Definition at line 84 of file log_stream.hpp.


Constructor & Destructor Documentation

claw::file_logger::file_logger ( const std::string &  filename)

Constructor.

Definition at line 79 of file log_stream.cpp.

{
  m_file = new std::ofstream( filename.c_str() );
} // file_logger::file_logger()
claw::file_logger::~file_logger ( ) [virtual]

Destructor.

Definition at line 88 of file log_stream.cpp.

{
  delete m_file;
} // file_logger::~file_logger()

Member Function Documentation

void claw::file_logger::flush ( ) [virtual]

Flush the stream.

Reimplemented from claw::log_stream.

Definition at line 106 of file log_stream.cpp.

{
  m_file->flush();
} // file_logger::flush()
void claw::file_logger::write ( const std::string &  str) [virtual]

Write a string in the file.

Implements claw::log_stream.

Definition at line 97 of file log_stream.cpp.

{
  (*m_file) << str;
} // file_logger::write()

Member Data Documentation

std::ofstream* claw::file_logger::m_file [private]

The file in which we write the messages.

Definition at line 97 of file log_stream.hpp.


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