Dv::Util::logstream::LogFilter Class Reference

Implements Filter interface for filterstreambuf. More...

List of all members.

Public Member Functions

 LogFilter (const std::string &path, const std::string &prefix)
 Constructor.
 LogFilter (std::ostream &stream, const std::string &prefix)
 Constructor, stream is managed by client.
 ~LogFilter ()
 Destructor.
int put (int c)
 Output a character.
int get ()
 Input a character, always fails.
int sync ()
 Flush buffers.
void close ()
 This is a noop.
void prefix (const std::string &prefix)
 Set prefix that will be printer at the start of each output line.
const std::string & prefix () const
std::ios::iostate state () const

Private Attributes

bool owner_
std::string buf_
std::string prefix_
std::ostream * stream_
bool lastnl_

Detailed Description

Implements Filter interface for filterstreambuf.

Definition at line 34 of file logstream.h.


Constructor & Destructor Documentation

Dv::Util::logstream::LogFilter::LogFilter ( const std::string &  path,
const std::string &  prefix 
)

Constructor.

Parameters:
path name of file on which log will be written.
prefix,: each output line will start with the current date and the prefix string
See also:
Dv::Util::Date
Dv::Util::logstream::LogFilter::LogFilter ( std::ostream &  stream,
const std::string &  prefix 
)

Constructor, stream is managed by client.

Parameters:
stream open output stream on which log will be written.
prefix,: each output line will start with the current date and the prefix string
See also:
Dv::Util::Date
Dv::Util::logstream::LogFilter::~LogFilter (  ) 

Destructor.


Member Function Documentation

int Dv::Util::logstream::LogFilter::put ( int  c  ) 

Output a character.

Parameters:
c char to output
Returns:
c is all went well, EOF otherwise.
int Dv::Util::logstream::LogFilter::get (  )  [inline]

Input a character, always fails.

Returns:
EOF, this is an output-only filter.

Definition at line 61 of file logstream.h.

int Dv::Util::logstream::LogFilter::sync (  ) 

Flush buffers.

Returns:
0 if ok, EOF otherwise
void Dv::Util::logstream::LogFilter::close (  )  [inline]

This is a noop.

Definition at line 69 of file logstream.h.

void Dv::Util::logstream::LogFilter::prefix ( const std::string &  prefix  )  [inline]

Set prefix that will be printer at the start of each output line.

Definition at line 73 of file logstream.h.

References prefix_.

Referenced by Dv::Util::logstream::prefix().

const std::string& Dv::Util::logstream::LogFilter::prefix (  )  const [inline]
Returns:
prefix that is used on output
See also:
prefix(const std::string&)

Definition at line 78 of file logstream.h.

References prefix_.

std::ios::iostate Dv::Util::logstream::LogFilter::state (  )  const
Returns:
iostate of underlying stream

Member Data Documentation

Definition at line 84 of file logstream.h.

std::string Dv::Util::logstream::LogFilter::buf_ [private]

Definition at line 85 of file logstream.h.

Definition at line 86 of file logstream.h.

Referenced by prefix().

std::ostream* Dv::Util::logstream::LogFilter::stream_ [private]

Definition at line 87 of file logstream.h.

Definition at line 88 of file logstream.h.


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

dvutil-1.0.10 [ 5 December, 2009]