Loading...
Searching...
No Matches
BALL::LogStreamBuf Class Reference

`#include <BALL/COMMON/logStream.h>`

Inheritance diagram for BALL::LogStreamBuf:

## Classes

struct | StreamStruct
struct | LoglineStruct

## Public Member Functions

Constructors and Destructors
| LogStreamBuf ()
virtual | ~LogStreamBuf ()
Debugging and Diagnostics
virtual void | dump (std::ostream &s)

## Static Public Attributes

Constants
static const int | MAX_LEVEL
static const int | MIN_LEVEL
static const Time | MAX_TIME

## Friends

class | LogStream

## Stream methods

typedef struct LoglineStruct | Logline
char * | pbuf_
vector< Logline > | loglines_
int | level_
int | tmp_level_
list< StreamStruct > | stream_list_
string | incomplete_line_
virtual int | sync ()
int | sync (bool force_flush)
virtual int | overflow (int c=-1)
string | expandPrefix_ (const string &prefix, int level, Time time) const

## Detailed Description

Stream buffer used by LogStream. This class implements the low level behaviour of LogStream . It takes care of the buffers and stores the lines written into the LogStream object. It also contains a list of streams that are associated with the LogStream object. This list contains pointers to the streams and their minimum and maximum log level. Each line entered in the LogStream is marked with its time (in fact, the time sync was called) and its loglevel. The loglevel is determined by either the current loglevel (as set by LogStream::setLevel or a temporary level (as set by LogStream::level for a single line only). For each line stored, the list of associated streams is checked whether the loglevel falls into the range declared by the stream's minimum and maximum level. If this condition is met, the logline (with its prefix, see LogStream::setPrefix ) is also copied to the associated stream and this stream is flushed, too.

Definition at line 80 of file logStream.h.

## Member Typedef Documentation

## Logline

typedef struct LoglineStruct BALL::LogStreamBuf::Logline

protected

Definition at line 189 of file logStream.h.

## Constructor & Destructor Documentation

## LogStreamBuf()

BALL::LogStreamBuf::LogStreamBuf | ( |  | ) |

Default constructor. Create a new LogStreamBuf object.

## ~LogStreamBuf()

virtual BALL::LogStreamBuf::~LogStreamBuf | ( |  | ) |

virtual

Destructor. Destruct the buffer and free all stored messages strings.

## Member Function Documentation

## dump()

virtual void BALL::LogStreamBuf::dump | ( | std::ostream & | s | ) |

virtual

Dump method. Dumps the contents of the whole message buffer including time and log level.

## expandPrefix_()

string BALL::LogStreamBuf::expandPrefix_ | ( | const string & | prefix,
|  | int | level,
|  | Time | time ) const

protected

## overflow()

virtual int BALL::LogStreamBuf::overflow | ( | int | c = -1 | ) |

virtual

Overflow method. This method calls sync and streambuf::overflow(c) to prevent a buffer overflow.

## sync() [1/2]

virtual int BALL::LogStreamBuf::sync | ( |  | ) |

virtual

Sync method. This method is called as soon as the ostream is flushed (especially this method is called by flush or endl). It transfers the contents of the streambufs putbuffer into a logline if a newline or linefeed character is found in the buffer ("\n" or "\r" resp.). The line is then removed from the putbuffer. Incomplete lines (not terminated by "\n" / "\r" are stored in incomplete_line_.

## sync() [2/2]

int BALL::LogStreamBuf::sync | ( | bool | force_flush | ) |

## Friends And Related Symbol Documentation

## LogStream

friend class LogStream

friend

Definition at line 84 of file logStream.h.

## Member Data Documentation

## incomplete_line_

string BALL::LogStreamBuf::incomplete_line_

protected

Definition at line 205 of file logStream.h.

## level_

int BALL::LogStreamBuf::level_

protected

Definition at line 199 of file logStream.h.

## loglines_

vector<Logline> BALL::LogStreamBuf::loglines_

protected

Definition at line 197 of file logStream.h.

## MAX_LEVEL

const int BALL::LogStreamBuf::MAX_LEVEL

static

Definition at line 91 of file logStream.h.

## MAX_TIME

const Time BALL::LogStreamBuf::MAX_TIME

static

Definition at line 93 of file logStream.h.

## MIN_LEVEL

const int BALL::LogStreamBuf::MIN_LEVEL

static

Definition at line 92 of file logStream.h.

## pbuf_

char* BALL::LogStreamBuf::pbuf_

protected

Definition at line 195 of file logStream.h.

## stream_list_

list<StreamStruct> BALL::LogStreamBuf::stream_list_

protected

Definition at line 203 of file logStream.h.

## tmp_level_

int BALL::LogStreamBuf::tmp_level_

protected

Definition at line 201 of file logStream.h.