eVaf
|
Logger interface for eVaf modules and applications. More...
#include <Common/ilogger.h>
Public Types | |
enum | Severity { None = 0, Fatal, Error, Warning, Info, Debug, Count } |
Severity levels for messages indicating the meaning and seriousness of the message. More... | |
Signals | |
void | loggerEvent (Common::iLogger::Severity severity, QString const &text, QString const &source, QString const &where) |
Logger event signal. More... | |
Public Member Functions | |
virtual Severity | consoleSeverity () const =0 |
Returns the current console severity level. More... | |
virtual QString | defaultSource () const =0 |
Returns the current default source name. More... | |
iLogger () | |
Interface constructor. More... | |
virtual FatalMsgHandler | installFatalMsgHandler (FatalMsgHandler newHandler)=0 |
Installs a fatal error message handler. More... | |
virtual uint | maxCount (QString const &source=0)=0 |
Returns the maximum number of log files. More... | |
virtual uint | maxSize (QString const &source=0)=0 |
Returns the current maximum size of log files in KiB. More... | |
virtual QString | printable (QByteArray const &msg) const =0 |
Replaces non-printable characters in the input string with human-readable strings. More... | |
virtual QString | printf (char const *const fmt,...) const =0 |
Helper function for formatting messages using the standard printf() function. More... | |
virtual void | setConsoleSeverity (Severity severity)=0 |
Changes the console severity level. More... | |
virtual void | setDefaultSource (QString const &source)=0 |
Sets the default source. More... | |
virtual void | setMaxCount (uint maxCount, QString const &source=0)=0 |
Changes the maximum number of log files. More... | |
virtual void | setMaxSize (uint maxSize, QString const &source=0)=0 |
Changes the maximum size of log files for the given source. More... | |
virtual void | setSeverity (Severity severity, QString const &source=0)=0 |
Changes the current severity level. More... | |
virtual Severity | severity (QString const &source=0)=0 |
Returns the current severity level. More... | |
virtual void | write (Severity severity, QString const &msg, QString const &source=0, QString const &where=0)=0 |
Outputs a message. More... | |
virtual | ~iLogger () |
Empty virtual destructor. More... | |
Static Public Member Functions | |
static iLogger * | instance () |
Returns the iLogger interface instance. More... | |
Logger interface for eVaf modules and applications.
Severity levels for messages indicating the meaning and seriousness of the message.
|
inline |
|
inlinevirtual |
|
pure virtual |
Returns the current console severity level.
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Returns the current default source name.
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Installs a fatal error message handler.
newHandler | The new fatal error message handler |
This function installs a custom fatal error message handler. The custom fatal error message handler is responsible for giving feedback to the user and terminating the application.
The default fatal error message handler outputs the message to stderr and terminates the application.
Implemented in eVaf::Common::Internal::Logger.
|
static |
Returns the iLogger interface instance.
The instance() function returns the global iLogger interface instance. As all the modules and applications are expected to be linked against the Common library, then this is the preferred method of obtaining the iLogger interface. The other method is by using the iRegistry interface.
|
signal |
Logger event signal.
severity | Severity of the message |
text | The message |
source | Source of the message |
where | Where the message was output |
This signal is emitted for every message output with the iLogger interface. Connect your receiver to this signal if you want to add your own message handling. For example, use this signal to show messages in a log window etc.
|
pure virtual |
Returns the maximum number of log files.
source | Name of the source or default if omitted. |
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Returns the current maximum size of log files in KiB.
source | Name of the source or default if omitted. |
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Replaces non-printable characters in the input string with human-readable strings.
msg | The input string |
This function replaces all the non-printable characters with human-readable strings, like ASCII symbol names or HEX codes.
For example, the Line Feed character will be replaced with "[LF]".
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Helper function for formatting messages using the standard printf() function.
fmt | The format string |
... | Variable number of arguments |
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Changes the console severity level.
severity | The new console severity level |
This function changes the console severity level. By default, only fatal errors are output to the console.
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Sets the default source.
source | The new default source name. |
Use the setDefaultSource() function to change the default source name. If not set, then uses the default source name "common".
Changing the name of the default source resets any other settings set for the default source.
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Changes the maximum number of log files.
maxCount | The new maximum number |
source | Name of the source or default if omitted |
This function sets the maximum number of log files including the current log file and any backup files. Older backup files are deleted to keep the number of log files at the maximum.
The default value for all the sources is usually 3 (the current log file plus 2 backup files).
Set the maximum number of log files to 0 for no limits (dangerous!).
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Changes the maximum size of log files for the given source.
maxSize | The new maximum size in KiB |
source | Name of the source of default if omitted. |
This function changes the maximum size of log files. Log files larger than this value will be renamed to backup files.
The default value for all the sources is usually 100 KiB.
Set the maximum size to 0 for no limits (dangerous!).
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Changes the current severity level.
severity | The new severity level |
source | Name of the source or default if omitted. |
This function changes the severity level of the given logger source. By default, only fatal errors are output. With this function the severity level can be changed so that also less important messages are output.
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Returns the current severity level.
source | Name of the source or default if omitted. |
Implemented in eVaf::Common::Internal::Logger.
|
pure virtual |
Outputs a message.
severity | Severity of the message, ie how important it is. |
msg | The message to be output |
source | Source of the message or default if omitted. |
where | Location in the source file where the message was output. |
This function writes a message to the log file if the severity is high enough. If the severity is lower than the current severity level, then does nothing.
If the source parameter is given, then uses the specified source. Otherwise writes to the default log file.
The where parameter can be used to indicate the location in the source file where the message was generated.
Messages for the default source are also output to the console if the console severity level is high enough.
Implemented in eVaf::Common::Internal::Logger.