eVaf
|
iLogger interface implementation. More...
#include <Common/logger.h>
Signals | |
void | writeToLogFile (LoggerSource const &src, QString const &msg) |
Signals inherited from eVaf::Common::iLogger | |
void | loggerEvent (Common::iLogger::Severity severity, QString const &text, QString const &source, QString const &where) |
Logger event signal. More... | |
Public Member Functions | |
virtual iLogger::Severity | consoleSeverity () const |
Returns the current console severity level. More... | |
virtual QString | defaultSource () const |
Returns the current default source name. More... | |
bool | init () |
Initializes the iLogger interface implementation. More... | |
virtual FatalMsgHandler | installFatalMsgHandler (FatalMsgHandler newHandler) |
Installs a fatal error message handler. More... | |
Logger () | |
virtual uint | maxCount (QString const &source=0) |
Returns the maximum number of log files. More... | |
virtual uint | maxSize (QString const &source=0) |
Returns the current maximum size of log files in KiB. More... | |
virtual QString | printable (QByteArray const &msg) const |
Replaces non-printable characters in the input string with human-readable strings. More... | |
virtual QString | printf (char const *const fmt,...) const |
Helper function for formatting messages using the standard printf() function. More... | |
virtual void | setConsoleSeverity (iLogger::Severity severity) |
Changes the console severity level. More... | |
virtual void | setDefaultSource (QString const &source) |
Sets the default source. More... | |
virtual void | setMaxCount (uint maxCount, QString const &source=0) |
Changes the maximum number of log files. More... | |
virtual void | setMaxSize (uint maxSize, QString const &source=0) |
Changes the maximum size of log files for the given source. More... | |
virtual void | setSeverity (iLogger::Severity severity, QString const &source=0) |
Changes the current severity level. More... | |
virtual iLogger::Severity | severity (QString const &source=0) |
Returns the current severity level. More... | |
virtual void | write (Severity severity, QString const &msg, QString const &source=0, QString const &where=0) |
Outputs a message. More... | |
virtual | ~Logger () |
Public Member Functions inherited from eVaf::Common::iLogger | |
iLogger () | |
Interface constructor. More... | |
virtual | ~iLogger () |
Empty virtual destructor. More... | |
Additional Inherited Members | |
Public Types inherited from eVaf::Common::iLogger | |
enum | Severity { None = 0, Fatal, Error, Warning, Info, Debug, Count } |
Severity levels for messages indicating the meaning and seriousness of the message. More... | |
Static Public Member Functions inherited from eVaf::Common::iLogger | |
static iLogger * | instance () |
Returns the iLogger interface instance. More... | |
eVaf::Common::Internal::Logger::Logger | ( | ) |
|
virtual |
|
inlinevirtual |
Returns the current console severity level.
Implements eVaf::Common::iLogger.
|
virtual |
Returns the current default source name.
Implements eVaf::Common::iLogger.
bool eVaf::Common::Internal::Logger::init | ( | ) |
Initializes the iLogger interface implementation.
|
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.
Implements eVaf::Common::iLogger.
|
virtual |
Returns the maximum number of log files.
source | Name of the source or default if omitted. |
Implements eVaf::Common::iLogger.
|
virtual |
Returns the current maximum size of log files in KiB.
source | Name of the source or default if omitted. |
Implements eVaf::Common::iLogger.
|
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]".
Implements eVaf::Common::iLogger.
|
virtual |
Helper function for formatting messages using the standard printf() function.
fmt | The format string |
... | Variable number of arguments |
Implements eVaf::Common::iLogger.
|
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.
Implements eVaf::Common::iLogger.
|
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.
Implements eVaf::Common::iLogger.
|
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!).
Implements eVaf::Common::iLogger.
|
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!).
Implements eVaf::Common::iLogger.
|
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.
Implements eVaf::Common::iLogger.
|
virtual |
Returns the current severity level.
source | Name of the source or default if omitted. |
Implements eVaf::Common::iLogger.
|
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.
Implements eVaf::Common::iLogger.
|
signal |