WvStreams
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
WvLogBuffer Class Reference

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

#include <wvlogbuffer.h>

Inheritance diagram for WvLogBuffer:
Inheritance graph
[legend]

Classes

class  Msg
 
class  MsgCounter
 

Public Member Functions

 DeclareWvList (Msg)
 
 DeclareWvDict (MsgCounter, WvString, src_lvl)
 
 WvLogBuffer (int _max_lines, WvLog::LogLevel _max_level=WvLog::NUM_LOGLEVELS)
 
MsgList & messages ()
 
void feed_receiver (WvLogRcv &receiver)
 
void dump (WvStream &s)
 
 DeclareWvList (Msg)
 
 DeclareWvDict (MsgCounter, WvString, src_lvl)
 
 WvLogBuffer (int _max_lines, WvLog::LogLevel _max_level=WvLog::NUM_LOGLEVELS)
 
MsgList & messages ()
 
void feed_receiver (WvLogRcv &receiver)
 
void dump (WvStream &s)
 
virtual void log (WvStringParm source, int loglevel, const char *_buf, size_t len)
 
virtual void log (WvStringParm source, int loglevel, const char *_buf, size_t len)
 
void end_line ()
 
void end_line ()
 
WvLog::LogLevel level () const
 
void level (WvLog::LogLevel lvl)
 
WvLog::LogLevel level () const
 
void level (WvLog::LogLevel lvl)
 
bool set_custom_levels (WvString descr)
 
bool set_custom_levels (WvString descr)
 

Public Attributes

bool force_new_line
 

Static Public Attributes

static const char * loglevels [WvLog::NUM_LOGLEVELS]
 

Protected Member Functions

void handle_msg (Msg *lastmsg)
 
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.
 
void handle_msg (Msg *lastmsg)
 
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.
 
 DeclareWvScatterDict (Src_Lvl, WvString, src)
 
 DeclareWvScatterDict (Src_Lvl, WvString, src)
 
virtual void _make_prefix (time_t now)
 Set the Prefix and Prefix Length (size_t prelen)
 
virtual void _make_prefix (time_t now)
 Set the Prefix and Prefix Length (size_t prelen)
 
const char * appname (WvStringParm log) const
 
const char * appname (WvStringParm log) const
 

Protected Attributes

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

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 debian/libwvstreams-dev/usr/include/wvstreams/wvlogbuffer.h.

Constructor & Destructor Documentation

◆ WvLogBuffer()

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

Definition at line 35 of file wvlogbuffer.cc.

◆ ~WvLogBuffer()

WvLogBuffer::~WvLogBuffer ( )
virtual

Definition at line 42 of file wvlogbuffer.cc.

Member Function Documentation

◆ handle_msg()

void WvLogBuffer::handle_msg ( Msg lastmsg)
protected

Definition at line 53 of file wvlogbuffer.cc.

◆ _begin_line() [1/2]

virtual void WvLogBuffer::_begin_line ( )
inlineprotectedvirtual

Start a new log line (print prefix)

Reimplemented from WvLogRcv.

Definition at line 64 of file debian/libwvstreams-dev/usr/include/wvstreams/wvlogbuffer.h.

◆ _mid_line() [1/2]

void WvLogBuffer::_mid_line ( const char *  str,
size_t  len 
)
protectedvirtual

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 WvBufBaseCommonImpl< T >::put().

◆ _end_line() [1/2]

void WvLogBuffer::_end_line ( )
protectedvirtual

End this (Guaranteed NonEmpty) log line.

Reimplemented from WvLogRcv.

Definition at line 75 of file wvlogbuffer.cc.

References WvBufBaseCommonImpl< T >::get(), WvBufBaseCommonImpl< T >::put(), trim_string(), WvBufBaseCommonImpl< T >::used(), and WvBufBaseCommonImpl< T >::zap().

◆ messages() [1/2]

MsgList & WvLogBuffer::messages ( )
inline

◆ feed_receiver()

void WvLogBuffer::feed_receiver ( WvLogRcv receiver)

Definition at line 89 of file wvlogbuffer.cc.

◆ dump()

void WvLogBuffer::dump ( WvStream s)

Definition at line 102 of file wvlogbuffer.cc.

◆ _begin_line() [2/2]

virtual void WvLogBuffer::_begin_line ( )
inlineprotectedvirtual

Start a new log line (print prefix)

Reimplemented from WvLogRcv.

Definition at line 64 of file include/wvlogbuffer.h.

◆ _mid_line() [2/2]

virtual void WvLogBuffer::_mid_line ( const char *  str,
size_t  len 
)
protectedvirtual

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.

◆ _end_line() [2/2]

virtual void WvLogBuffer::_end_line ( )
protectedvirtual

End this (Guaranteed NonEmpty) log line.

Reimplemented from WvLogRcv.

◆ messages() [2/2]

MsgList & WvLogBuffer::messages ( )
inline

Definition at line 73 of file include/wvlogbuffer.h.

◆ _make_prefix() [1/2]

void WvLogRcv::_make_prefix ( time_t  now)
protectedvirtualinherited

Set the Prefix and Prefix Length (size_t prelen)

Reimplemented in WvCrashLog, WvLogFileBase, WvCrashLog, and WvLogFileBase.

Definition at line 240 of file wvlog.cc.

◆ _make_prefix() [2/2]

virtual void WvLogRcv::_make_prefix ( time_t  now)
protectedvirtualinherited

Set the Prefix and Prefix Length (size_t prelen)

Reimplemented in WvCrashLog, WvLogFileBase, WvCrashLog, and WvLogFileBase.

◆ log() [1/2]

void WvLogRcv::log ( WvStringParm  source,
int  loglevel,
const char *  _buf,
size_t  len 
)
virtualinherited

Implements WvLogRcvBase.

Definition at line 272 of file wvlog.cc.

◆ log() [2/2]

virtual void WvLogRcv::log ( WvStringParm  source,
int  loglevel,
const char *  _buf,
size_t  len 
)
virtualinherited

Implements WvLogRcvBase.

◆ end_line() [1/2]

void WvLogRcv::end_line ( )
inlineinherited

◆ end_line() [2/2]

void WvLogRcv::end_line ( )
inlineinherited

Definition at line 83 of file include/wvlogrcv.h.

◆ level() [1/4]

WvLog::LogLevel WvLogRcv::level ( ) const
inlineinherited

◆ level() [2/4]

void WvLogRcv::level ( WvLog::LogLevel  lvl)
inlineinherited

◆ level() [3/4]

WvLog::LogLevel WvLogRcv::level ( ) const
inlineinherited

Definition at line 87 of file include/wvlogrcv.h.

◆ level() [4/4]

void WvLogRcv::level ( WvLog::LogLevel  lvl)
inlineinherited

Definition at line 89 of file include/wvlogrcv.h.

◆ set_custom_levels()

bool WvLogRcv::set_custom_levels ( WvString  descr)
inherited

Definition at line 379 of file wvlog.cc.

◆ appname()

const char * WvLogRcvBase::appname ( WvStringParm  log) const
protectedinherited

Definition at line 186 of file wvlog.cc.

Member Data Documentation

◆ msgs

MsgList WvLogBuffer::msgs
protected

◆ counters

MsgCounterDict WvLogBuffer::counters
protected

◆ current

WvDynBuf WvLogBuffer::current
protected

◆ max_lines

int WvLogBuffer::max_lines
protected

◆ last_source

WvString WvLogRcv::last_source
protectedinherited

◆ max_level

WvLog::LogLevel WvLogRcv::max_level
protectedinherited

◆ last_level

WvLog::LogLevel WvLogRcv::last_level
protectedinherited

◆ last_time

time_t WvLogRcv::last_time
protectedinherited

◆ at_newline

bool WvLogRcv::at_newline
protectedinherited

◆ prefix

WvString WvLogRcv::prefix
protectedinherited

◆ prelen

size_t WvLogRcv::prelen
protectedinherited

◆ custom_levels

Src_LvlDict WvLogRcv::custom_levels
protectedinherited

◆ loglevels

const char * WvLogRcv::loglevels
staticinherited
Initial value:
= {
"Crit",
"Err",
"Warn",
"Notice",
"Info",
"*1",
"*2",
"*3",
"*4",
"*5",
}

Definition at line 24 of file debian/libwvstreams-dev/usr/include/wvstreams/wvlogrcv.h.

◆ force_new_line

bool WvLogRcvBase::force_new_line
inherited

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