Static class implementing the user interface by info messages.
More...
#include <Logger.h>
|
static void | SetLevel (const TLogLevel actualLogLevel) |
| Set the log level. More...
|
|
static TLogLevel | GetLevel () |
| Get the log level.
|
|
template<typename... Args> |
static void | Log (const TLogLevel queryLevel, const std::string &format, Args...args) |
| Log desired activity for a given log level, version with string format. More...
|
|
static void | Log (const TLogLevel queryLevel, const std::string &message) |
| Log desired activity for a given log level. More...
|
|
static void | Error (const std::string &errorMessage) |
| Log an error. More...
|
|
static void | ErrorAndTerminate (const std::string &errorMessage) |
| Log an error and terminate the execution. More...
|
|
static void | Flush (const TLogLevel queryLevel) |
| Flush output messages. More...
|
|
static std::string | WordWrapString (const std::string &inputString, const std::string &delimiters, const int indentation=0, const int lineSize=65) |
| Wrap the line based on logger conventions. More...
|
|
template<typename... Args> |
static std::string | FormatMessage (const std::string &format, Args...args) |
| C++-11 replacement for sprintf that works with std::string instead of char *. More...
|
|
|
| TLogger () |
| Default constructor is not allowed, static class.
|
|
| TLogger (const TLogger &orig) |
| Copy constructor is not allowed, static class.
|
|
| ~TLogger () |
| Destructor is not allowed, static class.
|
|
|
static std::string | GetWord (std::istringstream &textStream, const std::string &delimiters) |
| Extract a word (string between two delimiters) More...
|
|
StaticClass used for printing out info and error message based on the verbose level. This is a static class.
Definition at line 50 of file Logger.h.
A enum to specify at which log level the message should be displayed, or the level set.
Enumerator |
---|
BASIC |
Basic (default) level of verbosity.
|
ADVANCED |
Advanced level of verbosity.
|
FULL |
Full level of verbosity.
|
Definition at line 60 of file Logger.h.
void TLogger::Error |
( |
const std::string & |
errorMessage | ) |
|
|
static |
Log an error.
- Parameters
-
[in] | errorMessage | - Error message to be printed out. |
Definition at line 81 of file Logger.cpp.
void TLogger::ErrorAndTerminate |
( |
const std::string & |
errorMessage | ) |
|
|
static |
Log an error and terminate the execution.
- Parameters
-
[in] | errorMessage | - error message to be printed to stderr |
Definition at line 94 of file Logger.cpp.
void TLogger::Flush |
( |
const TLogLevel |
queryLevel | ) |
|
|
static |
Flush logger, output messages only.
- Parameters
-
[in] | queryLevel | - Log level of the flush |
Definition at line 109 of file Logger.cpp.
template<typename... Args>
static std::string TLogger::FormatMessage |
( |
const std::string & |
format, |
|
|
Args... |
args |
|
) |
| |
|
inlinestatic |
string TLogger::GetWord |
( |
std::istringstream & |
textStream, |
|
|
const std::string & |
delimiters |
|
) |
| |
|
staticprivate |
Extract a word from a string stream based on delimiters.
- Parameters
-
[in,out] | textStream | - Input text stream |
[in] | delimiters | - List of delimiters as a single string |
- Returns
- A word firm the string
Definition at line 200 of file Logger.cpp.
template<typename... Args>
static void TLogger::Log |
( |
const TLogLevel |
queryLevel, |
|
|
const std::string & |
format, |
|
|
Args... |
args |
|
) |
| |
|
inlinestatic |
Log desired activity and format it using format message.
- Parameters
-
[in] | queryLevel | - What level to use |
[in] | format | - Format string |
[in] | args | - Arguments, std::string is not accepted |
Definition at line 85 of file Logger.h.
void TLogger::Log |
( |
const TLogLevel |
queryLevel, |
|
|
const std::string & |
message |
|
) |
| |
|
static |
end of SetLevel
Log desired activity.
- Parameters
-
[in] | queryLevel | - Log level of the message |
[in] | message | - Message to log |
Definition at line 66 of file Logger.cpp.
void TLogger::SetLevel |
( |
const TLogLevel |
actualLogLevel | ) |
|
|
static |
Initialise or change logging level.
- Parameters
-
[in] | actualLogLevel | - Log level for the logger |
Definition at line 53 of file Logger.cpp.
string TLogger::WordWrapString |
( |
const std::string & |
inputString, |
|
|
const std::string & |
delimiters, |
|
|
const int |
indentation = 0 , |
|
|
const int |
lineSize = 65 |
|
) |
| |
|
static |
Wrap the line based on delimiters and align it with the rest of the logger output.
- Parameters
-
[in] | inputString | - Input string |
[in] | delimiters | - String of delimiters, every char is a delimiter |
[in] | indentation | - Indentation from the beginning |
[in] | lineSize | - Line size |
- Returns
- Wrapped string
- Note
- The string must not contain tabulator and end-of-line characters.
Definition at line 130 of file Logger.cpp.
static declaration of the LogLevel private field
Definition at line 156 of file Logger.h.
The documentation for this class was generated from the following files: