#include <logger.h>
|
enum | LogOutputMode {
Signal = 1<<0,
Stdout = 1<<1,
Stderr = 1<<2,
File = 1<<3,
FileHtml = 1<<4,
DebugOutput = 1<<5,
NoFileOutput = Signal | Stdout | Stderr | DebugOutput,
FileOutput = File | FileHtml
} |
|
enum | LogUpdateMode { LogUpdateMode::Manual,
LogUpdateMode::Immediate
} |
|
enum | LogLevel { LogLevel::Error,
LogLevel::Warning,
LogLevel::Information,
LogLevel::Debug
} |
|
Logger. Manages log messages.
Log level. The log level which associate with the message.
Enumerator |
---|
Error |
Error.
|
Warning |
Warning.
|
Information |
Information.
|
Debug |
Debugging (used only for the debug mode).
|
Output mode of the logger. Determines the way to output log entries. The mode can be selected using binary operators.
Enumerator |
---|
Signal |
Output to signal LogUpdate.
|
Stdout |
Output to standard output.
|
Stderr |
Output to standard error.
|
File |
Output to external file (in plane text).
|
FileHtml |
Output to external file (in HTML format).
|
DebugOutput |
Output to debug output (only for VC).
|
NoFileOutput |
Specifies the mode with no file output.
|
FileOutput |
Specifies the mode with file output.
|
Update mode of the logger. Specifies how to process the log entries.
Enumerator |
---|
Manual |
Processes the entries in ProcessOutput function.
|
Immediate |
Processes the entry immediately. Note that the output mode is limited to NoFileOutput.
|
boost::signals2::connection Logger::Connect_LogUpdate |
( |
const std::function< void(LogEntry *)> & |
func | ) |
|
|
static |
Connect to LogUpdate signal. The signal is emitted when the output mode is Signal and a log entry is being processed. Note that processed entry is disposed.
- Parameters
-
int Logger::CountFileOutputEntries |
( |
| ) |
|
|
static |
Get number of log entries for the mode FileOutput.
- Returns
- Number of log entries.
int Logger::CountNoFileOutputEntries |
( |
| ) |
|
|
static |
Get number of log entries for the mode NoFileOutput.
- Returns
- Number of log entries.
void Logger::Debug |
( |
const std::string & |
message, |
|
|
const std::string & |
prefix |
|
) |
| |
|
static |
Add a debug log message.
- Parameters
-
message | Log message. |
prefix | Prefix message (inserted before indentation). |
Check if the log queue is empty.
- Return values
-
true | The queue is empty. |
false | The queue is not empty. |
void Logger::Error |
( |
const std::string & |
message, |
|
|
const std::string & |
prefix |
|
) |
| |
|
static |
Add an error log message.
- Parameters
-
message | Log message. |
prefix | Prefix message (inserted before indentation). |
std::string Logger::FormattedDebugInfo |
( |
const char * |
fileName, |
|
|
int |
line |
|
) |
| |
|
static |
Helper function to output formatted debug message.
- Parameters
-
fileName | File name. |
line | Line number. |
- Returns
- Formatted log message.
unsigned int Logger::Indentation |
( |
| ) |
|
|
static |
Get current indentation size.
- Returns
- Indentation.
void Logger::Info |
( |
const std::string & |
message, |
|
|
const std::string & |
prefix |
|
) |
| |
|
static |
Add an information log message.
- Parameters
-
message | Log message. |
prefix | Prefix message (inserted before indentation). |
void Logger::ProcessOutput |
( |
| ) |
|
|
static |
Process logger. Dispatches the output process of log entries. The function must be called in the event loop.
Reset the logger to the initial state.
void Logger::SetIndentation |
( |
unsigned int |
indentation | ) |
|
|
static |
Set the indentation size.
- Parameters
-
void Logger::SetOutputFileName |
( |
const std::string & |
fileName | ) |
|
|
static |
Set output file name. The file name is used for the mode File or FileHtml. The default value is nanon.log.
- Parameters
-
fileName | Output file name. |
void Logger::SetOutputFrequency |
( |
int |
freq | ) |
|
|
static |
Set output frequency. Set to dispatch the output process by freq milliseconds. Default value is 10.
- Parameters
-
freq | Frequency in milliseconds. |
void Logger::SetOutputFrequencyForFileOutput |
( |
int |
freq | ) |
|
|
static |
Set frequency of log output for file output. Changes log output frequency by once per freq entries when the output mode is File or FileHtml. The frequency should be set relatively slow. The default value is 100.
void Logger::SetOutputMode |
( |
int |
mode | ) |
|
|
static |
Set output mode of the logger. In default the log output is redirected to the signal LogUpdate.
- Parameters
-
Set the update mode of the logger. Default value is Manual, so the function ProcessOutput must be called by regular intervals.
- Parameters
-
void Logger::Warn |
( |
const std::string & |
message, |
|
|
const std::string & |
prefix |
|
) |
| |
|
static |
Add a warning log message.
- Parameters
-
message | Log message. |
prefix | Prefix message (inserted before indentation). |
The documentation for this class was generated from the following files:
- /home/travis/build/hi2p-perim/lightmetrica/include/lightmetrica/logger.h
- /home/travis/build/hi2p-perim/lightmetrica/src/liblightmetrica/logger.cpp