Singleton, keeps records of logging state. More...
#include <mbl_log.h>
Public Types | |
typedef vcl_map< vcl_string, vcl_ostream * > | stream_names_t |
Public Member Functions | |
const mbl_log_categories & | categories () |
List of category entries. | |
void | load_log_config_file (const stream_names_t &stream_names=stream_names_t()) |
Load a default configuration file. | |
void | load_log_config (vcl_istream &config, const stream_names_t &stream_names=stream_names_t()) |
Load a configuration from a stream. | |
void | update_all_loggers () |
Force all loggers to update themselves in light of changes to the root and configuration. | |
Private Member Functions | |
mbl_logger_root () | |
Private Attributes | |
mbl_log_categories | categories_ |
mbl_log_null_streambuf | null_streambuf_ |
vcl_ostream | null_stream_ |
vcl_set< mbl_logger * > | all_loggers_ |
Friends | |
class | mbl_logger |
typedef vcl_map<vcl_string, vcl_ostream *> mbl_logger_root::stream_names_t |
const mbl_log_categories& mbl_logger_root::categories | ( | ) | [inline] |
void mbl_logger_root::load_log_config | ( | vcl_istream & | is, |
const stream_names_t & | stream_names = stream_names_t() |
||
) |
Load a configuration from a stream.
Load a default configuration file.
Each section of the text should begin with a category. A logger named "A.B.C" will be controlled by a section labelled A.B.C The categories labels have a hierarchical structure, so if A.B.C doesn't exist, the code will look for a section labelled A.B, or A. If none of these exist it will use the "root" category. Each category has a level. If a log message has the same or higher priority than the given level, the message will be output. Finally the category destination must be specified as a "file_output" and the filename or "stream_output" and the stream name. The known stream names are "vcl_cout" and "vcl_cerr", and additional names can be provided through stream_names
. The
root: { level: INFO stream_output: test } obj3: { level: INFO stream_output: vcl_cout }\n obj3.obj6: { level: INFO file_output: results.txt }\n obj3.obj7.images: { level: INFO stream_output: vcl_cout dump_prefix: ./logging_dir/ }\n
where LEVEL is an integer - setting the logging level. see mbl_logger:levels for useful values.
Current Format is
LEVEL
where LEVEL is an integer - setting the logging level. see mbl_logger:levels for useful values.
Definition at line 475 of file mbl_log.cxx.
void mbl_logger_root::load_log_config_file | ( | const stream_names_t & | stream_names = stream_names_t() | ) |
Load a default configuration file.
This function will look for a configuration file called "mbl_log.properties" in the current directory, or if no there, in the user's home directory. Unix users can call it ".mbl_log.properties" in their home directory. See load_log_config() for description of config file format, and stream_names
.
Current Format is
LEVEL
where LEVEL is an integer - setting the logging level. see mbl_logger:levels for useful values.
Definition at line 421 of file mbl_log.cxx.
void mbl_logger_root::update_all_loggers | ( | ) |
Force all loggers to update themselves in light of changes to the root and configuration.
This is already called automatically by load_log_config_file().
Definition at line 485 of file mbl_log.cxx.
friend class mbl_logger [friend] |
vcl_set<mbl_logger*> mbl_logger_root::all_loggers_ [private] |
vcl_ostream mbl_logger_root::null_stream_ [private] |