![]() |
ImFusion SDK 4.3
|
Logging framework. More...
Logging framework.
Classes | |
class | ConsoleSink |
Default implementation for a Logger that prints to the attached console/terminal. More... | |
class | FileSink |
Default implementation for a Logger that writes to the filesystem. More... | |
class | Sink |
Interface for a logger sink that can receive individual log events. More... | |
Enumerations | |
enum class | Level { Trace = 0 , Debug = 1 , Info = 2 , Warning = 3 , Error = 4 , Fatal = 5 , Quiet = 6 } |
Severity of the log event. More... | |
enum class | Mode { Synchronous , Asynchronous } |
Operation mode of the log worker: More... | |
Functions | |
void | init (Level globalMinimumLevel, Mode operationMode) |
Initialize the logging framework. | |
void | deinit () |
Deinitialize the logging framework. | |
bool | isInitialized () |
Return whether the logging framework has been initialized. | |
bool | isAccepted (Level level, const char *category) noexcept |
Checks whether a log message is accepted by at least one of the registered sinks. | |
Level | globalLevel () |
Return the global minimum log level/severity that is going to be handled. | |
Level | setGlobalLevel (Level maximumLevel) |
Set the global minimum log level/severity that is going to be handled. | |
void | log (Level level, const char *category, const std::string &message, const char *fileName="", int line=-1) |
Logs the given message on all registered loggers. | |
void | flush () |
Ensures that all log messages have been fully written, also in async mode. | |
void | addSink (std::unique_ptr< Sink > sink) |
Registers the given sink so that it will receive future log events. | |
std::unique_ptr< Sink > | removeSink (Sink *sink) |
Removes a previously added sink so that it will no longer receive log events. | |
std::vector< Sink * > | getSinks () |
Returns a list of all registered logger sinks. | |
bool | isAccepted (Level level, const std::string &category) noexcept |
void | log (Level level, const std::string &category, const std::string &message, const char *fileName="", int line=-1) |
Variables | |
Level | g_globalLevel |
|
strong |
Operation mode of the log worker:
Enumerator | |
---|---|
Synchronous | All log events are synchronously forwarded to all registered loggers. A call to log() does not return before all loggers have finished logging the event. |
Asynchronous | All log events are temporarily stored by the worker and forwarded to the loggers in an asynchronous fashion. A call to log() will return immediately, however the log events are not necessarily processed by all loggers at this point. |