lestes::msg::logger Class Reference

#include <logger.hh>

Inheritance diagram for lestes::msg::logger:

Inheritance graph
[legend]
List of all members.

Public Types

typedef map< lstring, srp<
logger > > 
children_map_type
 Map that maps lstrings to loggers, used to store children of a logger.

Public Member Functions

ptr< loggerparent_get () const
lstring name_get () const
ptr< children_map_typechildren_get () const
ptr< logger_formatterformatter_get () const
void formatter_set (ptr< logger_formatter > x)
::std::ostream & operator<< (const ptr< logger_formatter > &)

Static Public Member Functions

static ptr< loggercreate (const lstring &a_name, const ptr< logger > &a_parent)
 Factory method, creates logger with given name. Also adds it to 'children' of given parent.
static ptr< loggerroot_instance ()
 Returns pointer to the root "grandparent" logger.
static bool init (const lstring &filename)
 Configures the logger tree by applying the settings found in given xml file.
static void finish ()
 Closes all files open during init().
::std::ostream & dump_skeleton (::std::ostream &)
 Traverses the logger tree starting at root_instance(), outputs xml configuration file with corresponding elements.

Protected Member Functions

 logger (const lstring &a_name, const ptr< logger > a_parent)
 Constructor run from the 'create' factory method.
void gc_mark ()
 Marks the keystone.

Private Types

typedef map< lstring, srp<
ostream_wrapper > > 
files_map_type

Private Member Functions

 logger ()
 This ctor is only used to construct the root logger.

Static Private Member Functions

static void subtree_dump (const ptr< logger > &,::std::ostream &)
 Dumps all children (including "transitive" ones:) as xml to given ostream; used internally by dump_skeleton method.

Private Attributes

bool logging
 Whether this logger is supposed to actually do something.
bool logging_changed
 True when logging field has already been changed.
srp< ostream_wrapper > ostr
 Pointer to a stream used for the actual logging.
const lstring name
 Name of this logger. This does not include names of parents.
const srp< loggerparent
 Pointer to parent logger, the root logger points to self; checked.
const srp< children_map_typechildren
srp< logger_formatterformatter
 the default formatter

Static Private Attributes

static ptr< loggerthe_root_instance = the_root_instance
 Hold pointer to the root logger instance.
static ptr< files_map_typefiles_map = files_map_type::create()
static ptr< ostream_wrapper > null_ostream
static ptr< ostream_wrapper > cerr_wrapper

Friends

class logger_configurator

Detailed Description

... One should only instantiate this class by hand when they know what they are doing.


Member Typedef Documentation

typedef map< lstring, srp<logger> > lestes::msg::logger::children_map_type

Map that maps lstrings to loggers, used to store children of a logger.

typedef map< lstring, srp<ostream_wrapper> > lestes::msg::logger::files_map_type [private]


Constructor & Destructor Documentation

lestes::msg::logger::logger (  )  [private]

This ctor is only used to construct the root logger.

lestes::msg::logger::logger ( const lstring &  a_name,
const ptr< logger a_parent 
) [protected]

Constructor run from the 'create' factory method.


Member Function Documentation

ptr< logger > lestes::msg::logger::create ( const lstring &  a_name,
const ptr< logger > &  a_parent 
) [static]

Factory method, creates logger with given name. Also adds it to 'children' of given parent.

ptr< logger > lestes::msg::logger::root_instance (  )  [static]

Returns pointer to the root "grandparent" logger.

bool lestes::msg::logger::init ( const lstring &  filename  )  [static]

Configures the logger tree by applying the settings found in given xml file.

Tries to parse filename of given name and apply settings in it to the logger tree. After returning true, should not be called again (violation is detected and not fatal). When not called at all, all loggers are off.

Returns:
false when file could not be read or parsed, when the root element is invalid, or when the root element did not contain the required attributes

true otherwise; this includes some non-fatal errors which are reported to the user

void lestes::msg::logger::finish (  )  [static]

Closes all files open during init().

Can be called without logger::init() being called previously.

std::ostream & lestes::msg::logger::dump_skeleton ( ::std::ostream &   )  [static]

Traverses the logger tree starting at root_instance(), outputs xml configuration file with corresponding elements.

ptr< logger > lestes::msg::logger::parent_get (  )  const

lstring lestes::msg::logger::name_get (  )  const

ptr< logger::children_map_type > lestes::msg::logger::children_get (  )  const

ptr< logger_formatter > lestes::msg::logger::formatter_get (  )  const

void lestes::msg::logger::formatter_set ( ptr< logger_formatter x  ) 

std::ostream & lestes::msg::logger::operator<< ( const ptr< logger_formatter > &   ) 

void lestes::msg::logger::subtree_dump ( const ptr< logger > &  ,
::std::ostream &   
) [static, private]

Dumps all children (including "transitive" ones:) as xml to given ostream; used internally by dump_skeleton method.

void lestes::msg::logger::gc_mark ( void   )  [protected, virtual]

Marks the keystone.

Marks all directly reachable parts of the class. The method must be overriden for each inherited class. It should contain abc.gc_mark() for each field abc of the inherited class and call to gc_mark() of the direct ancestor of the class. Does nothing for keystone, only stops processing of ancestors.

Reimplemented from lestes::std::mem::keystone.


Friends And Related Function Documentation

friend class logger_configurator [friend]


Member Data Documentation

bool lestes::msg::logger::logging [private]

Whether this logger is supposed to actually do something.

bool lestes::msg::logger::logging_changed [private]

True when logging field has already been changed.

srp<ostream_wrapper> lestes::msg::logger::ostr [private]

Pointer to a stream used for the actual logging.

const lstring lestes::msg::logger::name [private]

Name of this logger. This does not include names of parents.

const srp<logger> lestes::msg::logger::parent [private]

Pointer to parent logger, the root logger points to self; checked.

const srp<children_map_type> lestes::msg::logger::children [private]

srp< logger_formatter > lestes::msg::logger::formatter [private]

the default formatter

ptr< logger > lestes::msg::logger::the_root_instance = the_root_instance [static, private]

Hold pointer to the root logger instance.

ptr< logger::files_map_type > lestes::msg::logger::files_map = files_map_type::create() [static, private]

ptr< ostream_wrapper > lestes::msg::logger::null_ostream [static, private]

Initial value:

                ostream_wrapper::create( new ::std::ofstream(), true )

ptr< ostream_wrapper > lestes::msg::logger::cerr_wrapper [static, private]

Initial value:

                ostream_wrapper::create( &::std::cerr, false )


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:49:38 2007 for lestes by doxygen 1.5.1-20070107