Apache Log4cxx  Version 1.3.0
Loading...
Searching...
No Matches
log4cxx::logstream_base Class Referenceabstract

Base class for the basic_logstream template which attempts to emulate std::basic_ostream but attempts to short-circuit unnecessary operations. More...

#include <stream.h>

Inheritance diagram for log4cxx::logstream_base:
log4cxx::logstream log4cxx::ulogstream log4cxx::wlogstream

Public Member Functions

 logstream_base (const log4cxx::LoggerPtr &logger, const log4cxx::LevelPtr &level)
 Create new instance.
 
virtual ~logstream_base ()
 Destructor.
 
void insert (std::ios_base &(*manip)(std::ios_base &))
 Insertion operator for std::fixed and similar manipulators.
 
int precision ()
 get precision.
 
int width ()
 get width.
 
int precision (int newval)
 set precision.
 
int width (int newval)
 set width.
 
int fill ()
 Get fill character.
 
int fill (int newval)
 Set fill character.
 
std::ios_base::fmtflags flags (std::ios_base::fmtflags newflags)
 Set flags.
 
std::ios_base::fmtflags setf (std::ios_base::fmtflags newflags, std::ios_base::fmtflags mask)
 Set flags.
 
std::ios_base::fmtflags setf (std::ios_base::fmtflags newflags)
 Set flags.
 
void end_message ()
 end of message action.
 
void setLevel (const LevelPtr &level)
 Set the level.
 
bool isEnabled () const
 Returns true if the current level is the same or high as the level of logger at time of construction or last setLevel.
 
bool isEnabledFor (const LevelPtr &level) const
 Returns if logger is currently enabled for the specified level.
 
void setLocation (const log4cxx::spi::LocationInfo &location)
 Sets the location for subsequent log requests.
 
bool set_stream_state (std::ios_base &os, int &fillchar)
 Sets the state of the embedded stream (if any) to the state of the formatting info.
 

Static Public Member Functions

static logstream_baseendmsg (logstream_base &)
 end of message manipulator, triggers logging.
 
static logstream_basenop (logstream_base &)
 no-operation manipulator, Used to avoid ambiguity with VC6.
 

Protected Member Functions

virtual void log (LoggerPtr &logger, const LevelPtr &level, const log4cxx::spi::LocationInfo &location)=0
 Dispatches the pending log request.
 
virtual void erase ()=0
 Erase any content in the message construction buffer.
 
virtual void get_stream_state (std::ios_base &base, std::ios_base &mask, int &fill, bool &fillSet) const =0
 Copy state of embedded stream (if any) to value and mask instances of std::ios_base and return fill character value.
 
virtual void refresh_stream_state ()=0
 

Detailed Description

Base class for the basic_logstream template which attempts to emulate std::basic_ostream but attempts to short-circuit unnecessary operations.

The logstream has a logger and level that are used for logging requests. The level of the stream is compared against the current level of the logger to determine if the request should be processed.

Constructor & Destructor Documentation

◆ logstream_base()

log4cxx::logstream_base::logstream_base ( const log4cxx::LoggerPtr logger,
const log4cxx::LevelPtr level 
)

Create new instance.

Parameters
loggerlogger logger used in log requests.
levelindicates level that will be used in log requests. Can be modified later by inserting a level or calling setLevel.

◆ ~logstream_base()

virtual log4cxx::logstream_base::~logstream_base ( )
virtual

Destructor.

Member Function Documentation

◆ end_message()

void log4cxx::logstream_base::end_message ( )

end of message action.

◆ endmsg()

static logstream_base & log4cxx::logstream_base::endmsg ( logstream_base )
static

end of message manipulator, triggers logging.

◆ erase()

virtual void log4cxx::logstream_base::erase ( )
protectedpure virtual

Erase any content in the message construction buffer.

Implemented in log4cxx::logstream, log4cxx::wlogstream, and log4cxx::ulogstream.

◆ fill() [1/2]

int log4cxx::logstream_base::fill ( )

Get fill character.

◆ fill() [2/2]

int log4cxx::logstream_base::fill ( int  newval)

Set fill character.

◆ flags()

std::ios_base::fmtflags log4cxx::logstream_base::flags ( std::ios_base::fmtflags  newflags)

Set flags.

see std::ios_base.

◆ get_stream_state()

virtual void log4cxx::logstream_base::get_stream_state ( std::ios_base &  base,
std::ios_base &  mask,
int &  fill,
bool &  fillSet 
) const
protectedpure virtual

Copy state of embedded stream (if any) to value and mask instances of std::ios_base and return fill character value.

Implemented in log4cxx::logstream, log4cxx::wlogstream, and log4cxx::ulogstream.

◆ insert()

void log4cxx::logstream_base::insert ( std::ios_base &(*)(std::ios_base &)  manip)

Insertion operator for std::fixed and similar manipulators.

◆ isEnabled()

bool log4cxx::logstream_base::isEnabled ( ) const
inline

Returns true if the current level is the same or high as the level of logger at time of construction or last setLevel.

◆ isEnabledFor()

bool log4cxx::logstream_base::isEnabledFor ( const LevelPtr level) const

Returns if logger is currently enabled for the specified level.

◆ log()

virtual void log4cxx::logstream_base::log ( LoggerPtr logger,
const LevelPtr level,
const log4cxx::spi::LocationInfo location 
)
protectedpure virtual

Dispatches the pending log request.

Implemented in log4cxx::logstream, log4cxx::wlogstream, and log4cxx::ulogstream.

◆ nop()

static logstream_base & log4cxx::logstream_base::nop ( logstream_base )
static

no-operation manipulator, Used to avoid ambiguity with VC6.

◆ precision() [1/2]

int log4cxx::logstream_base::precision ( )

get precision.

◆ precision() [2/2]

int log4cxx::logstream_base::precision ( int  newval)

set precision.

This should be used in preference to inserting an std::setprecision(n) since the other requires construction of an STL stream which may be expensive.

◆ refresh_stream_state()

virtual void log4cxx::logstream_base::refresh_stream_state ( )
protectedpure virtual

◆ set_stream_state()

bool log4cxx::logstream_base::set_stream_state ( std::ios_base &  os,
int &  fillchar 
)

Sets the state of the embedded stream (if any) to the state of the formatting info.

Parameters
osstream to receive formatting info.
fillcharreceives fill charater.
Returns
true if fill character was specified.

◆ setf() [1/2]

std::ios_base::fmtflags log4cxx::logstream_base::setf ( std::ios_base::fmtflags  newflags)

Set flags.

see std::ios_base.

◆ setf() [2/2]

std::ios_base::fmtflags log4cxx::logstream_base::setf ( std::ios_base::fmtflags  newflags,
std::ios_base::fmtflags  mask 
)

Set flags.

see std::ios_base.

◆ setLevel()

void log4cxx::logstream_base::setLevel ( const LevelPtr level)

Set the level.

Parameters
levellevel

◆ setLocation()

void log4cxx::logstream_base::setLocation ( const log4cxx::spi::LocationInfo location)

Sets the location for subsequent log requests.

◆ width() [1/2]

int log4cxx::logstream_base::width ( )

get width.

◆ width() [2/2]

int log4cxx::logstream_base::width ( int  newval)

set width.

This should be used in preference to inserting an std::setw(n) since the other requires construction of an STL stream which may be expensive.


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