GemaCoreLib
The GeMA Core library
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
GmLogCategory Class Reference

Class representing a category with multiple logging levels. More...

#include <gmLog.h>

Collaboration diagram for GmLogCategory:
Collaboration graph
[legend]

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.
 
QLoggingCategoryqtCategory (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.
 

Detailed Description

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.

Member Function Documentation

◆ str2Level()

GmLogLevel GmLogCategory::str2Level ( const char *  levelStr)
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)


The documentation for this class was generated from the following files: