KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
Log::LogCategory Class Reference

A named logging category with an associated minimum log level. More...

#include <logcategory.h>

Public Member Functions

 LogCategory ()
 Default constructor — creates an invalid (unnamed) category at the default level.
 
 LogCategory (const QString &name)
 Construct a named category at the default log level.
 
QString name () const
 Return the category name.
 
LogLevel level () const
 Return the minimum log level for this category.
 
LogCategory append (const QString &name)
 Create a new category by appending a sub-name to this category's name.
 
LogCategory prepend (const QString &name)
 Create a new category by prepending a prefix to this category's name.
 
bool isValid () const
 Test whether this category has a non-empty name.
 

Static Public Member Functions

static QString parentName (const QString &name)
 Extract the parent portion of a dotted category name.
 
static LogLevel defaultLogLevel ()
 Return the process-wide default log level used for new categories.
 
static void setDefaultLogLevel (LogLevel value)
 Set the process-wide default log level used for new categories.
 

Static Public Attributes

static LogLevel DefaultLogLevel
 Process-wide default log level applied to newly created categories.
 

Protected Attributes

QString _name
 Category name string.
 
LogLevel _level
 Minimum log level threshold for this category.
 

Detailed Description

A named logging category with an associated minimum log level.

Categories allow fine-grained control over which log messages are emitted. Each category has a name and a level; messages logged below the category level are suppressed even if they would otherwise pass the global logger level.

Definition at line 33 of file logcategory.h.

Constructor & Destructor Documentation

◆ LogCategory() [1/2]

Log::LogCategory::LogCategory ( )
inline

Default constructor — creates an invalid (unnamed) category at the default level.

Definition at line 37 of file logcategory.h.

◆ LogCategory() [2/2]

Log::LogCategory::LogCategory ( const QString &  name)
inline

Construct a named category at the default log level.

Parameters
nameCategory name string

Definition at line 43 of file logcategory.h.

Member Function Documentation

◆ append()

LogCategory Log::LogCategory::append ( const QString &  name)

Create a new category by appending a sub-name to this category's name.

Parameters
nameSub-name to append (separated by '.')
Returns
New LogCategory with the combined name

◆ defaultLogLevel()

static LogLevel Log::LogCategory::defaultLogLevel ( )
inlinestatic

Return the process-wide default log level used for new categories.

Returns
Current default LogLevel

Definition at line 84 of file logcategory.h.

◆ isValid()

bool Log::LogCategory::isValid ( ) const
inline

Test whether this category has a non-empty name.

Returns
true if the name is non-empty

Definition at line 96 of file logcategory.h.

◆ level()

LogLevel Log::LogCategory::level ( ) const
inline

Return the minimum log level for this category.

Returns
Active LogLevel threshold for this category

Definition at line 57 of file logcategory.h.

◆ name()

QString Log::LogCategory::name ( ) const
inline

Return the category name.

Returns
Category name string

Definition at line 51 of file logcategory.h.

◆ parentName()

static QString Log::LogCategory::parentName ( const QString &  name)
static

Extract the parent portion of a dotted category name.

Parameters
nameFull dotted category name
Returns
Parent name (everything before the last '.')

◆ prepend()

LogCategory Log::LogCategory::prepend ( const QString &  name)

Create a new category by prepending a prefix to this category's name.

Parameters
namePrefix to prepend (separated by '.')
Returns
New LogCategory with the combined name

◆ setDefaultLogLevel()

static void Log::LogCategory::setDefaultLogLevel ( LogLevel  value)
inlinestatic

Set the process-wide default log level used for new categories.

Parameters
valueNew default LogLevel

Definition at line 90 of file logcategory.h.

Member Data Documentation

◆ _level

LogLevel Log::LogCategory::_level
protected

Minimum log level threshold for this category.

Definition at line 105 of file logcategory.h.

◆ _name

QString Log::LogCategory::_name
protected

Category name string.

Definition at line 103 of file logcategory.h.

◆ DefaultLogLevel

LogLevel Log::LogCategory::DefaultLogLevel
static

Process-wide default log level applied to newly created categories.

Definition at line 99 of file logcategory.h.


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