Kit for logging of messages from program.
More...
#include <logkit.hpp>
|
enum | MessageLevels {
Error = 1
, Warning = 2
, Low = 4
, Medium = 8
,
High = 16
, DebugLow = 32
, DebugHigh = 64
} |
| Symbols for use when sending message level and parsing exact levels. More...
|
|
enum | LimitLevels {
L_Error = 1
, L_Warning = 3
, L_Low = 7
, L_Medium = 15
,
L_High = 31
, L_DebugLow = 63
, L_DebugHigh = 127
} |
| Symbols for use when parsing given level and lower. More...
|
|
|
static void | SetFileLog (const std::string &fileName, int levels, bool includeNRLibLogging=true) |
| Set a file that logs independent of phase. More...
|
|
static void | SetFileLog (const std::string &fileName, const std::vector< int > &levels, bool ignore_general=false) |
| Set a full phase dependent file log. More...
|
|
static void | SetFileLog (const std::string &fileName, int levels, int phase, bool ignore_general=false) |
| Set single-phase file log, useful for debugging given phase. More...
|
|
static void | SetScreenLog (int levels, bool includeNRLibLogging=true) |
| Set a screen log independent of phase. More...
|
|
static void | SetScreenLog (const std::vector< int > &levels, bool ignore_general=false) |
| Set a full phase dependent screen log. More...
|
|
static void | LogMessage (int level, const std::string &message) |
| Send message independent of phase. More...
|
|
static void | LogMessage (int level, int phase, const std::string &message) |
| Send message in given phase. More...
|
|
static void | LogFormatted (int level, std::string format,...) |
| Send message as c-style format string and arguments. More...
|
|
static void | LogFormatted (int level, int phase, std::string format,...) |
| Send message as c-style format string and arguments. More...
|
|
static void | EndLog () |
| Close streams. More...
|
|
static void | StartBuffering () |
|
static void | EndBuffering () |
|
static void | SetPrefix (const std::string &prefix, int level) |
|
static int | GetNMessages (int level) |
|
static void | WriteHeader (const std::string &text, MessageLevels logLevel=Low) |
|
Kit for logging of messages from program.
◆ LimitLevels
Symbols for use when parsing given level and lower.
Enumerator |
---|
L_Error | |
L_Warning | |
L_Low | |
L_Medium | |
L_High | |
L_DebugLow | |
L_DebugHigh | |
◆ MessageLevels
Symbols for use when sending message level and parsing exact levels.
Philosophy: A message has a level, determining the type of message, and a phase, determining the stage in the program. Each stream has a level (which may be a combination of basic levels) for each phase. If phase and flag matches, the message is sent to the stream. A message without phase is default sent to all streams that would send it in at least one phase. If the ignore_general flag is set to true when generating a stream, that stream will ignore messages without phase.
The system can be used without bothering with phases. All NRLib logging is phase 0 LOW.
Enumerator |
---|
Error | |
Warning | |
Low | |
Medium | |
High | |
DebugLow | |
DebugHigh | |
◆ EndBuffering()
static void NRLib::LogKit::EndBuffering |
( |
| ) |
|
|
static |
◆ EndLog()
static void NRLib::LogKit::EndLog |
( |
| ) |
|
|
static |
◆ GetNMessages()
static int NRLib::LogKit::GetNMessages |
( |
int |
level | ) |
|
|
inlinestatic |
◆ LogFormatted() [1/2]
static void NRLib::LogKit::LogFormatted |
( |
int |
level, |
|
|
int |
phase, |
|
|
std::string |
format, |
|
|
|
... |
|
) |
| |
|
static |
Send message as c-style format string and arguments.
◆ LogFormatted() [2/2]
static void NRLib::LogKit::LogFormatted |
( |
int |
level, |
|
|
std::string |
format, |
|
|
|
... |
|
) |
| |
|
static |
Send message as c-style format string and arguments.
◆ LogMessage() [1/2]
static void NRLib::LogKit::LogMessage |
( |
int |
level, |
|
|
const std::string & |
message |
|
) |
| |
|
static |
Send message independent of phase.
◆ LogMessage() [2/2]
static void NRLib::LogKit::LogMessage |
( |
int |
level, |
|
|
int |
phase, |
|
|
const std::string & |
message |
|
) |
| |
|
static |
Send message in given phase.
◆ SetFileLog() [1/3]
static void NRLib::LogKit::SetFileLog |
( |
const std::string & |
fileName, |
|
|
const std::vector< int > & |
levels, |
|
|
bool |
ignore_general = false |
|
) |
| |
|
static |
Set a full phase dependent file log.
◆ SetFileLog() [2/3]
static void NRLib::LogKit::SetFileLog |
( |
const std::string & |
fileName, |
|
|
int |
levels, |
|
|
bool |
includeNRLibLogging = true |
|
) |
| |
|
static |
Set a file that logs independent of phase.
◆ SetFileLog() [3/3]
static void NRLib::LogKit::SetFileLog |
( |
const std::string & |
fileName, |
|
|
int |
levels, |
|
|
int |
phase, |
|
|
bool |
ignore_general = false |
|
) |
| |
|
static |
Set single-phase file log, useful for debugging given phase.
◆ SetPrefix()
static void NRLib::LogKit::SetPrefix |
( |
const std::string & |
prefix, |
|
|
int |
level |
|
) |
| |
|
static |
◆ SetScreenLog() [1/2]
static void NRLib::LogKit::SetScreenLog |
( |
const std::vector< int > & |
levels, |
|
|
bool |
ignore_general = false |
|
) |
| |
|
static |
Set a full phase dependent screen log.
◆ SetScreenLog() [2/2]
static void NRLib::LogKit::SetScreenLog |
( |
int |
levels, |
|
|
bool |
includeNRLibLogging = true |
|
) |
| |
|
static |
Set a screen log independent of phase.
◆ StartBuffering()
static void NRLib::LogKit::StartBuffering |
( |
| ) |
|
|
static |
Buffering allows temporary storage of messages for sending to files opened later. When a file log is opened, the buffer is dumped to it. EndBuffering should be called once all files are opened.
◆ WriteHeader()
The documentation for this class was generated from the following file:
|