![]() |
GemaCoreLib
The GeMA Core library
|
Class representing a category with multiple logging levels. More...
#include <gmLog.h>
Public Member Functions | |
GmLogCategory (QString name) | |
Constructor. Receives a category name (which should be unique). Should NOT be called outside of the main thread. | |
~GmLogCategory () | |
Destructor. | |
bool | isEnabled (GmLogLevel level) const |
Returns true if messages for this log level are enabled, false otherwise. | |
void | setEnabled (GmLogLevel level, bool mode) |
Enables or disables log messges for the requested level. | |
QLoggingCategory & | qtCategory (GmLogLevel level) const |
Returns the "Qt category" that represents the requested level. | |
Static Public Member Functions | |
static GmLogLevel | str2Level (const char *levelStr) |
Translates a category name into its log level. More... | |
Private Member Functions | |
Q_DISABLE_COPY (GmLogCategory) | |
Private Attributes | |
QByteArray | _names [GM_COUNT] |
Stores Qt category names (QLoggingCategory only stores the name pointer) | |
QLoggingCategory * | _categories [GM_COUNT] |
Qt categories. We will use one category per log level. | |
Class representing a category with multiple logging levels.
This class is used to overcome Qt's fixed number of logging levels. Each of our levels (defined in GmLogLevels) will be treated as a unique Qt category. Within Qt, every message will be logged with qCDebug.
|
static |
Translates a category name into its log level.
The provided string can be any string finishing in the supported level suffixes (trace, extinfo, info, warning, error, fatal, time or memory).
For invalid levels the result is unspecified (but always a valid enum level, probably GM_INFO)