VHISTlib
1.84.0.3018
|
A class which is a source for log messages. More...
#include <logsource.h>
Public Types | |
enum | LogType { LOG_MESSAGE, LOG_WARNING, LOG_ERROR } |
An enum defining different types of log messages. More... | |
Signals | |
void | log (const QString msg, const int type=LOG_MESSAGE) |
This signal is emitted by the LogSource to publish a log message. | |
Public Member Functions | |
LogSource (QObject *listener=NULL) | |
Creates a new LogSource object and registers a listener with it. | |
virtual | ~LogSource () |
Destroys a LogSource object. | |
void | publishToLogSlot (QObject *listener) |
Registers a listener with the LogSource object. | |
void | publishToLogSignal (QObject *listener) |
Registers a listener with the LogSource object. |
A class which is a source for log messages.
The class provides an interface to register loggers, which want to be notified about log messages generated by this class as well as a signal to emit log messages. Each object which wants to register at a LogSource object to receive log messages must provide either a slot or signal with signature void log(const QString, const LogSource::LogType) or void log(const QString).
LogSource::LogSource | ( | QObject * | listener = NULL | ) |
Creates a new LogSource object and registers a listener with it.
The listener must provide a slot with signature void log(const QString, const vhist::LogSource::LogType) or void log(const QString). The listener will receive all log messages generated by this class via the slot.
[in] | listener | A class which should listen to the log messages of the LogSource object. Can be NULL , in which case no object is registered. |
void vhist::LogSource::log | ( | const QString | message, |
const int | type = LOG_MESSAGE |
||
) | [signal] |
This signal is emitted by the LogSource to publish a log message.
The message has a type which tells whether its a simple message, a warning or an error.
[in] | message | The log message. |
[in] | type | The type of the log message. Valid values are all values in the enum vhist::LogSource::LogType. |
void LogSource::publishToLogSignal | ( | QObject * | listener | ) |
Registers a listener with the LogSource object.
The listener must provide a signal with signature void log(const QString, const int) or void log(const QString). All log messages will be forwarded to this signal.
[in] | listener | A class which should listen to the log messages of the LogSource object. Can be NULL , in which case no object is registered. |
void LogSource::publishToLogSlot | ( | QObject * | listener | ) |
Registers a listener with the LogSource object.
The listener must provide a slot with signature void log(const QString, const int) or void log(const QString). The listener will receive all log messages generated by this class via the slot.
[in] | listener | A class which should listen to the log messages of the LogSource object. Can be NULL , in which case no object is registered. |