the log stream class it features logs on cout, cerr, and files. it also features log domains and log levels.
More...
#include <nmv-log-stream.h>
|
| static void | set_stream_type (enum StreamType a_type) |
| | set the type of all the log streams that will be instanciated (either cout, cerr, or log file). By default, the type of stream is set to COUT_STREAM. All the logs are sent to stdout. More...
|
| |
| static enum StreamType | get_stream_type () |
| | gets the type of the instances of #LogStream More...
|
| |
| static void | set_stream_file_path (const char *a_file_path, long a_len=-1) |
| |
| static const char * | get_stream_file_path () |
| | gets the log file path, in case the stream type is set to FILE_STREAM More...
|
| |
| static void | set_log_level_filter (enum LogLevel a_level) |
| | sets the log level filter. if the filter is set to LOG_LEVEL_NORMAL, only the log streams that have a log level set to LOG_LEVEL_NORMAL will actually log data. If the filter is set to LOG_LEVEL_VERBOSE, streams set to LOG_LEVEL_NORMAL and streams set to LOG_LEVEL_VERBOSE will be logging data. More...
|
| |
| static void | set_log_domain_filter (const char *a_domain, long a_len=-1) |
| | sets a filter on the log domain only streams that have the same domain as the one set here will be logging data. More...
|
| |
| static void | activate (bool a_activate) |
| | activate/de-activate the logging. More...
|
| |
| static bool | is_active () |
| | tests wether the logging is activated or not. More...
|
| |
| static LogStream & | default_log_stream () |
| | gets the log stream instanciated by the system by default. the options of this log stream are the global options set before the first call to this method. More...
|
| |
the log stream class it features logs on cout, cerr, and files. it also features log domains and log levels.
◆ LogLevel
| Enumerator |
|---|
| LOG_LEVEL_NORMAL | |
| LOG_LEVEL_VERBOSE | |
◆ StreamType
| Enumerator |
|---|
| FILE_STREAM | |
| COUT_STREAM | |
| CERR_STREAM | |
| RFU0 | |
| RFU1 | |
| RFU2 | |
◆ LogStream()
| nemiver::common::LogStream::LogStream |
( |
enum LogLevel |
a_level = LOG_LEVEL_NORMAL, |
|
|
const string & |
a_default_domain = "general-domain" |
|
) |
| |
default constructor of a log stream
- Parameters
-
| a_level | the log level of the stream. This stream will log data if its log level is inferior or equal to the log level filter defined by LogStream::set_log_level_filter(). |
| a_domain | the log domain. A stream will log data if its its log level is <= to the log level filter, and if its domain equals the domain filter. |
◆ ~LogStream()
| virtual nemiver::common::LogStream::~LogStream |
( |
| ) |
|
|
virtual |
destructor of the log stream class
◆ activate()
| static void nemiver::common::LogStream::activate |
( |
bool |
a_activate | ) |
|
|
static |
activate/de-activate the logging.
- Parameters
-
| a_activate | true to activate the logging, false to deactivate. |
◆ default_log_stream()
| static LogStream& nemiver::common::LogStream::default_log_stream |
( |
| ) |
|
|
static |
gets the log stream instanciated by the system by default. the options of this log stream are the global options set before the first call to this method.
- Returns
- the log stream instanciated by default.
◆ enable_domain()
| void nemiver::common::LogStream::enable_domain |
( |
const string & |
a_domain, |
|
|
bool |
a_do_enable = true |
|
) |
| |
enable or disable logging for a domain
- Parameters
-
| a_domain | the domain to enable logging for |
| a_do_enable | when set to true, enables the logging for domain @a_domain, disable it otherwise. |
◆ get_stream_file_path()
| static const char* nemiver::common::LogStream::get_stream_file_path |
( |
| ) |
|
|
static |
gets the log file path, in case the stream type is set to FILE_STREAM
- Returns
- the path to the log file.
◆ get_stream_type()
| static enum StreamType nemiver::common::LogStream::get_stream_type |
( |
| ) |
|
|
static |
◆ is_active()
| static bool nemiver::common::LogStream::is_active |
( |
| ) |
|
|
static |
tests wether the logging is activated or not.
- Returns
- true if the logging is activated, false otherwise.
◆ is_domain_enabled()
| bool nemiver::common::LogStream::is_domain_enabled |
( |
const string & |
a_domain | ) |
|
- Returns
- true is logging is enabled for domain @a_domain
◆ operator<<() [1/7]
| LogStream& nemiver::common::LogStream::operator<< |
( |
char |
a_char | ) |
|
log a character
- Parameters
-
◆ operator<<() [2/7]
| LogStream& nemiver::common::LogStream::operator<< |
( |
const char * |
a_c_string | ) |
|
log zero teriminated strings
- Parameters
-
| a_string | the string to log |
◆ operator<<() [3/7]
| LogStream& nemiver::common::LogStream::operator<< |
( |
const Glib::ustring & |
a_string | ) |
|
log a UTF-8 string
- Parameters
-
| a_string | the string to log |
◆ operator<<() [4/7]
| LogStream& nemiver::common::LogStream::operator<< |
( |
const std::string & |
a_string | ) |
|
log a string
- Parameters
-
| a_string | the string to log |
◆ operator<<() [5/7]
| LogStream& nemiver::common::LogStream::operator<< |
( |
double |
a_double | ) |
|
◆ operator<<() [6/7]
| LogStream& nemiver::common::LogStream::operator<< |
( |
int |
an_int | ) |
|
log an integer
- Parameters
-
◆ operator<<() [7/7]
log a stream manipulator
- Parameters
-
| a_manipulator | the LogStream manipulator to log |
◆ pop_domain()
| void nemiver::common::LogStream::pop_domain |
( |
| ) |
|
◆ push_domain()
| void nemiver::common::LogStream::push_domain |
( |
const string & |
a_domain | ) |
|
set the domain in against which all the coming messages will be logged. This is to be used in association with the << operators where we cannot specify the domain to log against, unlike LogStream::write() .
- Parameters
-
| a_domain | the domain to log against. |
◆ set_log_domain_filter()
| static void nemiver::common::LogStream::set_log_domain_filter |
( |
const char * |
a_domain, |
|
|
long |
a_len = -1 |
|
) |
| |
|
static |
sets a filter on the log domain only streams that have the same domain as the one set here will be logging data.
- Parameters
-
| a_domain | the domain name. \a_len the length of the domain name. If <0, it means that a_domain is a zero terminated string. |
◆ set_log_level_filter()
| static void nemiver::common::LogStream::set_log_level_filter |
( |
enum LogLevel |
a_level | ) |
|
|
static |
sets the log level filter. if the filter is set to LOG_LEVEL_NORMAL, only the log streams that have a log level set to LOG_LEVEL_NORMAL will actually log data. If the filter is set to LOG_LEVEL_VERBOSE, streams set to LOG_LEVEL_NORMAL and streams set to LOG_LEVEL_VERBOSE will be logging data.
- Parameters
-
| a_level | the level of verbosity you want your log streams to have. |
◆ set_stream_file_path()
| static void nemiver::common::LogStream::set_stream_file_path |
( |
const char * |
a_file_path, |
|
|
long |
a_len = -1 |
|
) |
| |
|
static |
in the case where the stream type is set to FILE_STREAM, this methods sets the path of the file to log into. By default, the log file is ./log.txt
- Parameters
-
| a_file_path | the log file path. |
| a_len | the length of the file_path. If <0, it means that a_file_path is a zero terminated string. |
◆ set_stream_type()
| static void nemiver::common::LogStream::set_stream_type |
( |
enum StreamType |
a_type | ) |
|
|
static |
set the type of all the log streams that will be instanciated (either cout, cerr, or log file). By default, the type of stream is set to COUT_STREAM. All the logs are sent to stdout.
- Parameters
-
| a_type | the type of the log stream |
◆ write() [1/5]
| LogStream& nemiver::common::LogStream::write |
( |
char |
a_msg, |
|
|
const string & |
a_domain = "general-domain" |
|
) |
| |
◆ write() [2/5]
| LogStream& nemiver::common::LogStream::write |
( |
const char * |
a_buf, |
|
|
long |
a_buflen = -1, |
|
|
const string & |
a_domain = "general-domain" |
|
) |
| |
writes a text string to the stream
- Parameters
-
| a_buf | the buffer that contains the text string. |
| a_buflen | the length of the buffer. If <0, a_buf is considered as a zero terminated string. |
| a_domain | the domain the string has to be logged against. |
◆ write() [3/5]
| LogStream& nemiver::common::LogStream::write |
( |
const Glib::ustring & |
a_msg, |
|
|
const string & |
a_domain = "general-domain" |
|
) |
| |
log a message to the stream
- Parameters
-
| a_msg | the message to log |
| a_domain | the domain to log against |
◆ write() [4/5]
| LogStream& nemiver::common::LogStream::write |
( |
double |
a_msg, |
|
|
const string & |
a_domain = "general-domain" |
|
) |
| |
◆ write() [5/5]
| LogStream& nemiver::common::LogStream::write |
( |
int |
a_msg, |
|
|
const string & |
a_domain = "general-domain" |
|
) |
| |
◆ endl
log a '\n' and flushes the stream Use it like: nemiver::LogStream out; out << "hello"<< nemiver::endl;
◆ flush
flushes the stream Use it like: nemiver::LogStream out; out << "Hello" << nemiver::flush;
◆ level_normal
sets the log level to normal Use it like nemiver::LogStream out; out << nemiver::level_normal << "blabla";
◆ level_verbose
sets the log level to verbose Use it lik: nemiver::LogStream out; out << nemiver::level_verbose << "bla bla bla";
◆ timestamp
logs a timestamp. Basically the the current date. You use it like: nemiver::LogStream out; out << nemiver::timestamp ;
The documentation for this class was generated from the following file: