Class Scine::Utils::Log¶
-
class
Log
¶ Static class for logging.
By default, logging is disabled. Logging can be started with startConsoleLogging() or startFileLogging(). It is possible to have several files for logging.
Public Types
Public Functions
-
Log
()¶ Disabled constructor: this is a static class.
Public Static Functions
-
static void
disableLogging
()¶ This function disables all logging.
-
static void
enableLogging
()¶ This function reenables all logging if disableLogging() was called previously.
-
static void
flush
()¶ Flush the log messages.
It can be that log messages are temporarily stored in a buffer. This forces output to the respective stream.
-
static void
startFileLogging
(std::string filename, severity_level minimalSeverity = defaultMinimalSeverity_, bool autoFlush = false)¶ Start writing log to a file.
- Parameters
filename
: The path to the file to be logged to.minimalSeverity
: Log messages will be written only when their severity is at least as important as this.autoFlush
: Ff true, after each log message the stream will be flushed (at higher computational cost).
-
static void
startConsoleLogging
(severity_level minimalSeverity = defaultMinimalSeverity_)¶ (Re)starts logging to the console.
- Parameters
minimalSeverity
: Log messages will be written only when their severity is at least as important as this.
-
static void
stopConsoleLogging
()¶ Stops logging to the console.
-
static ChainedLogger
trace
()¶ Logging function to log statementes of the severity: trace.
Function returning a logger. Allows direct logging with the left-shift operator:
Log::trace() << "Information to log";
- Return
ChainedLogger The logger to be logged with.
-
static ChainedLogger
debug
()¶ Logging function to log statementes of the severity: debug.
Function returning a logger, the function0 allow dircet logging via the leftshift operator:
Log::debug() << "Information to log";
- Return
ChainedLogger The logger to be logged with.
-
static ChainedLogger
info
()¶ Logging function to log statementes of the severity: info.
Function returning a logger, the function0 allow dircet logging via the leftshift operator:
Log::info() << "Information to log";
- Return
ChainedLogger The logger to be logged with.
-
static ChainedLogger
warning
()¶ Logging function to log statementes of the severity: warning.
Function returning a logger, the function0 allow dircet logging via the leftshift operator:
Log::warning() << "Information to log";
- Return
ChainedLogger The logger to be logged with.
-
static ChainedLogger
error
()¶ Logging function to log statementes of the severity: error.
Function returning a logger, the function0 allow dircet logging via the leftshift operator:
Log::error() << "Information to log";
- Return
ChainedLogger The logger to be logged with.
-
static ChainedLogger
fatal
()¶ Logging function to log statementes of the severity: fatal.
Function returning a logger, the function0 allow dircet logging via the leftshift operator:
Log::fatal() << "Information to log";
- Return
ChainedLogger The logger to be logged with.
-
template<typename
String
>
static voidtrace
(String &&s)¶ Logging function to log statementes of the severity: trace.
- Template Parameters
String
:
- Parameters
s
: The statement to be logged.
-
template<typename
String
>
static voiddebug
(String &&s)¶ Logging function to log statementes of the severity: debug.
- Template Parameters
String
:
- Parameters
s
: The statement to be logged.
-
template<typename
String
>
static voidinfo
(String &&s)¶ Logging function to log statementes of the severity: info.
- Template Parameters
String
:
- Parameters
s
: The statement to be logged.
-
template<typename
String
>
static voidwarning
(String &&s)¶ Logging function to log statementes of the severity: warning.
- Template Parameters
String
:
- Parameters
s
: The statement to be logged.
-