MIRA
|
For detailed information see Logging
More...
Classes | |
class | LogConsoleSink |
Special class that uses LogTxtStreamSink as a base and cout as stream Provided for logging to console. More... | |
class | LogCustomizableFilter |
A customizable log filter to match the users needs. More... | |
class | LogCustomizableFormatter |
A customizable formatter. More... | |
class | LogFileSink |
A logging sink for file, which supports log file rotation and daily log files. More... | |
struct | LogRecord |
Holds all the information about a log entry. More... | |
struct | LogRecordFunctionInfo |
Holds information about a log entry function. More... | |
class | LogFormatterBase |
Abstract base class for sink formatters. More... | |
class | LogFilterBase |
Abstract base class for log filters. More... | |
class | LogSink |
Abstract base class for all log sinks. More... | |
class | LogCore |
Single instance of the core logging class. More... | |
class | Logger |
Helper class that is created to make one logging process atomic and thread safe. More... | |
class | LogSimpleFormatter |
Very simple log formatter logging the severity level, the time and the message. More... | |
class | LogTimer |
Class that can be used as a stop watch to measure execution time of operations. More... | |
class | LogTxtStreamSink |
Simple log sink for writing to streams like cout or file It uses the SimpleFormatter for output. More... | |
Macros | |
#define | MIRA_LOG_EXCEPTION(level, ex) |
Log the specified exception, including all information that the exception object carries. More... | |
#define | MIRA_LOG_SIGNAL(level, sig) |
Log the error string based on the specified signal and a backtrace if available. More... | |
#define | MIRA_LOGGER (mira::LogCore::instance()) |
Macro for easier access to the logging core instance. More... | |
#define | MIRA_SEVERITY_MAX_LEVEL mira::TRACE |
Compile time defined maximum log level In release build the maximum log level should be NOTICE to eliminate some of the logging and gain performance. More... | |
#define | MIRA_LOG(level) |
Use this macro to log data. More... | |
#define | MIRA_LOG_ALWAYS(level) |
Use this macro to log data. More... | |
#define | MIRA_LOG_ATTR(level, time, file, line, function, threadID) |
Use this macro to log data when you have collected the log data yourself. More... | |
#define | MIRA_LOGTIMER(level, name, text) |
Macro for starting a LogTimer. More... | |
#define | MIRA_PEEKLOGTIMER(name) name.peek(); |
Macro for peeking LogTimer class at a defined point. More... | |
#define | MIRA_ENDLOGTIMER(name) name.end(); |
Macro for ending LogTimer class at a defined point. More... | |
Enumerations | |
enum | SeverityLevel { CRITICAL = 0, ERROR = 1, WARNING = 2, NOTICE = 3, DEBUG = 4, TRACE = 5 } |
Severity levels to graduate between different log outputs. More... | |
Functions | |
template<typename Derived1 , typename Derived2 > | |
LogCustomizableFilter::AndOperator< Derived1, Derived2 > | operator & (const LogCustomizableFilter::CustomFilter< Derived1 > &f1, const LogCustomizableFilter::CustomFilter< Derived2 > &f2) |
Operator to combine filters by and. More... | |
template<typename Derived1 , typename Derived2 > | |
LogCustomizableFilter::OrOperator< Derived1, Derived2 > | operator| (const LogCustomizableFilter::CustomFilter< Derived1 > &f1, const LogCustomizableFilter::CustomFilter< Derived2 > &f2) |
Operator to combine filters by or. More... | |
MIRA_BASE_EXPORT SeverityLevel | stringToSeverityLevel (const std::string &levelString) |
Converts the specified string into a numeric severity level. More... | |
For detailed information see Logging
#define MIRA_LOG_EXCEPTION | ( | level, | |
ex | |||
) |
Log the specified exception, including all information that the exception object carries.
The usage is similar to MIRA_LOG.
#define MIRA_LOG_SIGNAL | ( | level, | |
sig | |||
) |
Log the error string based on the specified signal and a backtrace if available.
The usage is similar to MIRA_LOG.
#define MIRA_LOGGER (mira::LogCore::instance()) |
Macro for easier access to the logging core instance.
#define MIRA_SEVERITY_MAX_LEVEL mira::TRACE |
Compile time defined maximum log level In release build the maximum log level should be NOTICE to eliminate some of the logging and gain performance.
Effectively, MIRA_SEVERITY_MAX_LEVEL imposes a static plateau on the dynamically allowed range of logging levels: Any logging level above the static plateau is simply eliminated from the code.
#define MIRA_LOG | ( | level | ) |
Use this macro to log data.
e.g.
!!!ATTENTION!!! This code combines two tests. If you pass a compile time constant to MIRA_LOG, the first test is against two constants and any optimizer will pick that up statically and discard the dead branch entirely from generated code. The second test examines the runtime logging level. If the specified level is above the runtime logging level the branch will never be called. e.g. Assuming MIRA_SEVERITY_MAX_LEVEL is ERROR:
will be expanded by the preprocessor to
So the so important function will never be called when the runtime logging level is below the specified.
If you combine a MIRA_LOG with an if case it is strongly recommended to add {} around the MIRA_LOG statement:
Otherwise you will get compiler warnings about an ambiguous else. !!!ATTENTION!!!
#define MIRA_LOG_ALWAYS | ( | level | ) |
Use this macro to log data.
In contrast to MIRA_LOG() the log messages will be passed to the log sinks independent from the current severity level and build target. One can make use of LogCustomizableFilter to modify the severity levels for different log sinks.
#define MIRA_LOG_ATTR | ( | level, | |
time, | |||
file, | |||
line, | |||
function, | |||
threadID | |||
) |
Use this macro to log data when you have collected the log data yourself.
#define MIRA_LOGTIMER | ( | level, | |
name, | |||
text | |||
) |
Macro for starting a LogTimer.
#define MIRA_PEEKLOGTIMER | ( | name | ) | name.peek(); |
Macro for peeking LogTimer class at a defined point.
#define MIRA_ENDLOGTIMER | ( | name | ) | name.end(); |
Macro for ending LogTimer class at a defined point.
enum SeverityLevel |
LogCustomizableFilter::AndOperator<Derived1, Derived2> mira::operator& | ( | const LogCustomizableFilter::CustomFilter< Derived1 > & | f1, |
const LogCustomizableFilter::CustomFilter< Derived2 > & | f2 | ||
) |
Operator to combine filters by and.
LogCustomizableFilter::OrOperator<Derived1, Derived2> mira::operator| | ( | const LogCustomizableFilter::CustomFilter< Derived1 > & | f1, |
const LogCustomizableFilter::CustomFilter< Derived2 > & | f2 | ||
) |
Operator to combine filters by or.
MIRA_BASE_EXPORT SeverityLevel mira::stringToSeverityLevel | ( | const std::string & | levelString | ) |
Converts the specified string into a numeric severity level.
XInvalidParameter,if | the string does not name a valid level. |