Class sh::base::Logger¶
-
class
sh::base
::
Logger
: public QObject, public sh::base::Singleton¶ The logging manager.
Use it for writing messages to the Shallot log and for reading from it.
Note: Logging is easiest by the LOG_* macros like SH_LOG_INFO (and it provides more meta data!).
Public Functions
-
void
logException
(sh::exceptions::Exception &ex, LogSeverity severity = LogSeverity::ERROR, QString source = QString())¶ Logs an exception.
-
void
log
(QString message, LogSeverity severity, QString source = QString())¶ Logs a message.
-
QString
getLogAsText
(LogSeverity minseverity = LogSeverity::DEBUG)¶ Returns all logged messages as one text.
-
QList<LogMessage*>
logMessages
()¶ Returns the list of logged messages.
-
QString
logPrefix
()¶ Returns the log prefix, i.e. an optional string all log output begins with.
-
~Logger
()¶
-
void
doInitialize
()¶ Executes singleton initialization.
-
void
doShutdown
()¶ Executes singleton shutdown.
-
void
shutdown
()¶ Shutdown down this singleton.
-
bool
isAlive
()¶ Returns if this singleton is alive (true until its shutdown begins).
Signals
-
void
newLogMessageArrived
()¶ Emitted when a new log message was written.
Private Functions
-
Logger
()¶
-
struct
LogMessage
¶ A single log message.
-
void