Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

WvLogBuffer Class Reference

#include <wvlogbuffer.h>

Inherits WvLogRcv.

Collaboration diagram for WvLogBuffer:

[legend]
List of all members.

Detailed Description

WvLogBuffer is a descendant of WvLogRcv that buffers log messages for later use.

It only keeps up to max_lines log entries for every source/debug level, s.t. debug level <= max_level

Definition at line 17 of file wvlogbuffer.h.

Public Member Functions

 DeclareWvList (Msg)
 DeclareWvDict (MsgCounter, WvString, src_lvl)
 WvLogBuffer (int _max_lines, WvLog::LogLevel _max_level=WvLog::NUM_LOGLEVELS)
virtual ~WvLogBuffer ()
MsgList & messages ()
void dump (WvStream &s)
void end_line ()
WvLog::LogLevel level () const
void level (WvLog::LogLevel lvl)
bool set_custom_levels (WvString descr)

Static Public Attributes

char * loglevels [WvLog::NUM_LOGLEVELS]

Protected Member Functions

virtual void _begin_line ()
 Start a new log line (print prefix).

virtual void _mid_line (const char *str, size_t len)
 add text to the current log line.

virtual void _end_line ()
 End this (Guaranteed NonEmpty) log line.

 DeclareWvDict (Src_Lvl, WvString, src)
virtual void log (const WvLog *source, int loglevel, const char *_buf, size_t len)
virtual void _make_prefix ()
 Set the Prefix and Prefix Length (size_t prelen).

const char * appname (const WvLog *log) const

Protected Attributes

MsgList msgs
MsgCounterDict counters
WvDynBuf current
int max_lines
const WvLoglast_source
WvLog::LogLevel max_level
WvLog::LogLevel last_level
bool at_newline
WvString prefix
size_t prelen
Src_LvlDict custom_levels


Constructor & Destructor Documentation

WvLogBuffer::WvLogBuffer int  _max_lines,
WvLog::LogLevel  _max_level = WvLog::NUM_LOGLEVELS
 

Definition at line 35 of file wvlogbuffer.cc.

References counters, max_lines, and WvLogBuffer().

Referenced by WvLogBuffer().

WvLogBuffer::~WvLogBuffer  )  [virtual]
 

Definition at line 42 of file wvlogbuffer.cc.

References WvLogRcv::end_line().


Member Function Documentation

virtual void WvLogBuffer::_begin_line  )  [inline, protected, virtual]
 

Start a new log line (print prefix).

Reimplemented from WvLogRcv.

Definition at line 62 of file wvlogbuffer.h.

void WvLogBuffer::_end_line  )  [protected, virtual]
 

End this (Guaranteed NonEmpty) log line.

Reimplemented from WvLogRcv.

Definition at line 54 of file wvlogbuffer.cc.

References WvLogBuffer::MsgCounter::add(), WvLog::app, counters, current, WvBufBaseCommonImpl< T >::get(), max_lines, msgs, WvBufBaseCommonImpl< T >::put(), trim_string(), WvBufBaseCommonImpl< T >::used(), and WvBufBaseCommonImpl< T >::zap().

void WvLogRcv::_make_prefix  )  [protected, virtual, inherited]
 

Set the Prefix and Prefix Length (size_t prelen).

Reimplemented in WvLogFileBase.

Definition at line 165 of file wvlog.cc.

References WvLogRcv::last_level, WvLogRcv::last_source, WvFastString::len(), WvLogRcv::loglevels, WvLogRcv::prefix, and WvLogRcv::prelen.

Referenced by WvLogRcv::log().

void WvLogBuffer::_mid_line const char *  str,
size_t  len
[protected, virtual]
 

add text to the current log line.

'str' may contain only one '
' optional character at str[len-1] (the end); if it does, end_line will be called immediately after this function.

Implements WvLogRcv.

Definition at line 48 of file wvlogbuffer.cc.

References _mid_line(), current, and WvBufBaseCommonImpl< T >::put().

Referenced by _mid_line().

const char * WvLogRcvBase::appname const WvLog log  )  const [protected, inherited]
 

Definition at line 140 of file wvlog.cc.

References WvLog::app, WvLogRcvBase::appname(), and log.

Referenced by WvLogRcvBase::appname().

WvLogRcv::DeclareWvDict Src_Lvl  ,
WvString  ,
src 
[protected, inherited]
 

WvLogBuffer::DeclareWvDict MsgCounter  ,
WvString  ,
src_lvl 
 

WvLogBuffer::DeclareWvList Msg   ) 
 

void WvLogBuffer::dump WvStream s  ) 
 

Definition at line 86 of file wvlogbuffer.cc.

References dump(), WvLogBuffer::Msg::level, WvLogBuffer::Msg::message, messages(), WvStream::print(), WvLogBuffer::Msg::source, and WvLogBuffer::Msg::timestamp.

Referenced by dump(), and main().

void WvLogRcv::end_line  )  [inline, inherited]
 

Definition at line 82 of file wvlogrcv.h.

References WvLogRcv::_end_line(), and WvLogRcv::at_newline.

Referenced by WvLogRcv::log(), messages(), ~WvLogBuffer(), WvLogConsole::~WvLogConsole(), and WvSyslog::~WvSyslog().

void WvLogRcv::level WvLog::LogLevel  lvl  )  [inline, inherited]
 

Definition at line 88 of file wvlogrcv.h.

References WvLogRcv::max_level.

WvLog::LogLevel WvLogRcv::level  )  const [inline, inherited]
 

Definition at line 86 of file wvlogrcv.h.

References WvLogRcv::max_level.

Referenced by main().

void WvLogRcv::log const WvLog source,
int  loglevel,
const char *  _buf,
size_t  len
[protected, virtual, inherited]
 

Implements WvLogRcvBase.

Definition at line 197 of file wvlog.cc.

References WvLogRcv::_make_prefix(), WvLog::app, WvLogRcv::custom_levels, WvString::edit(), WvLogRcv::end_line(), WvLogRcv::last_level, WvLogRcv::last_source, WvLogRcv::max_level, my_isprint(), and strlwr().

MsgList& WvLogBuffer::messages  )  [inline]
 

Definition at line 71 of file wvlogbuffer.h.

References WvLogRcv::end_line(), and msgs.

Referenced by dump().

bool WvLogRcv::set_custom_levels WvString  descr  )  [inherited]
 

Definition at line 290 of file wvlog.cc.

References WvLogRcv::custom_levels, WvString::edit(), WvLogRcv::set_custom_levels(), WvStringList::split(), strlwr(), and trim_string().

Referenced by WvLogRcv::set_custom_levels().


Member Data Documentation

bool WvLogRcv::at_newline [protected, inherited]
 

Definition at line 33 of file wvlogrcv.h.

Referenced by WvLogRcv::end_line(), and WvLogRcv::WvLogRcv().

MsgCounterDict WvLogBuffer::counters [protected]
 

Definition at line 58 of file wvlogbuffer.h.

Referenced by _end_line(), and WvLogBuffer().

WvDynBuf WvLogBuffer::current [protected]
 

Definition at line 59 of file wvlogbuffer.h.

Referenced by _end_line(), and _mid_line().

Src_LvlDict WvLogRcv::custom_levels [protected, inherited]
 

Definition at line 48 of file wvlogrcv.h.

Referenced by WvLogRcv::log(), and WvLogRcv::set_custom_levels().

WvLog::LogLevel WvLogRcv::last_level [protected, inherited]
 

Definition at line 32 of file wvlogrcv.h.

Referenced by WvLogRcv::_make_prefix(), WvLogRcv::log(), and WvLogRcv::WvLogRcv().

const WvLog* WvLogRcv::last_source [protected, inherited]
 

Definition at line 31 of file wvlogrcv.h.

Referenced by WvLogRcv::_make_prefix(), WvLogRcv::log(), and WvLogRcv::WvLogRcv().

char * WvLogRcv::loglevels [static, inherited]
 

Initial value:

{ "Crit", "Err", "Warn", "Notice", "Info", "*1", "*2", "*3", "*4", "*5", }

Definition at line 23 of file wvlog.cc.

Referenced by WvLogRcv::_make_prefix().

WvLog::LogLevel WvLogRcv::max_level [protected, inherited]
 

Definition at line 32 of file wvlogrcv.h.

Referenced by WvLogRcv::level(), WvLogRcv::log(), and WvLogRcv::WvLogRcv().

int WvLogBuffer::max_lines [protected]
 

Definition at line 60 of file wvlogbuffer.h.

Referenced by _end_line(), and WvLogBuffer().

MsgList WvLogBuffer::msgs [protected]
 

Definition at line 53 of file wvlogbuffer.h.

Referenced by _end_line(), and messages().

WvString WvLogRcv::prefix [protected, inherited]
 

Definition at line 34 of file wvlogrcv.h.

Referenced by WvLogRcv::_begin_line(), and WvLogRcv::_make_prefix().

size_t WvLogRcv::prelen [protected, inherited]
 

Definition at line 35 of file wvlogrcv.h.

Referenced by WvLogRcv::_begin_line(), and WvLogRcv::_make_prefix().


The documentation for this class was generated from the following files:
Generated on Tue Oct 5 01:09:28 2004 for WvStreams by doxygen 1.3.7