|
KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
|
|
Logging subsystem providing categorized, level-filtered output. More...
Classes | |
| class | LogCategory |
| A named logging category with an associated minimum log level. More... | |
| class | LogEntry |
| Immutable record of a single log event. More... | |
| class | Logger |
| Core logger class supporting console, file, syslog, and consumer outputs. More... | |
| class | LogLevelToStringMap |
| Bidirectional map between LogLevel values and their string names. More... | |
Enumerations | |
| enum | LogLevel { Emergency = 0 , Alert = 1 , Critical = 2 , Error = 3 , Warning = 4 , Notice = 5 , Info = 6 , Debug = 7 } |
| Severity levels for log messages, ordered from most to least critical. More... | |
| enum | OutputFlags { None = 0x00000000 , LineNumbers = 0x00000001 , Timestamp = 0x00000002 , Level = 0x00000004 , Console = 0x00001000 , File = 0x00002000 , QDebug = 0x00004000 , Syslog = 0x00008000 , Standard = LineNumbers | Timestamp | Level | Console } |
| Bitmask flags controlling where log output is sent. More... | |
Functions | |
| KANOOP_EXPORT void | logText (const char *file, int lineNumber, LogLevel level, const QString &text) |
| Write a text message via the system logger. | |
| KANOOP_EXPORT void | logText (const char *file, int lineNumber, LogLevel level, const LogCategory &category, const QString &text) |
| Write a categorized text message via the system logger. | |
| KANOOP_EXPORT void | logHex (const char *file, int lineNumber, LogLevel level, const LogCategory &category, const QByteArray &data, const QString &tag=QString()) |
| Write a categorized hex dump via the system logger. | |
| KANOOP_EXPORT void | logHex (const char *file, int lineNumber, LogLevel level, const QByteArray &data, const QString &tag=QString()) |
| Write a hex dump via the system logger. | |
| KANOOP_EXPORT Logger * | systemLog () |
| Return the process-wide Logger singleton. | |
| KANOOP_EXPORT LogLevel | level () |
| Return the current minimum log level of the system logger. | |
| KANOOP_EXPORT void | setLevel (LogLevel value) |
| Set the minimum log level of the system logger. | |
| KANOOP_EXPORT OutputFlags | flags () |
| Return the output flags of the system logger. | |
| KANOOP_EXPORT void | setFlags (OutputFlags flags) |
| Set the output flags of the system logger. | |
| KANOOP_EXPORT QString | filename () |
| Return the log file path of the system logger. | |
| KANOOP_EXPORT void | setFilename (const QString &filename) |
| Set the log file path of the system logger. | |
| KANOOP_EXPORT QString | identity () |
| Return the syslog identity of the system logger. | |
| KANOOP_EXPORT void | setIdentity (const QString &value) |
| Set the syslog identity of the system logger. | |
| KANOOP_EXPORT void | enableOutputFlags (OutputFlags flags) |
| Enable additional output flags on the system logger. | |
| KANOOP_EXPORT void | disableOutputFlags (OutputFlags flags) |
| Disable specific output flags on the system logger. | |
| KANOOP_EXPORT LogCategory | registerCategory (const QString &name) |
| Register a log category by name with the system logger. | |
| KANOOP_EXPORT LogCategory | registerCategory (const QString &name, LogLevel level) |
| Register a log category by name and level with the system logger. | |
| KANOOP_EXPORT QList< LogCategory > | categories () |
| Return all categories registered with the system logger. | |
| KANOOP_EXPORT void | setCategoryLevel (const QString &name, LogLevel level) |
| Override the log level for a named category on the system logger. | |
| KANOOP_EXPORT void | addConsumer (LogConsumer *consumer) |
| Add an external log consumer to the system logger. | |
| KANOOP_EXPORT void | removeConsumer (LogConsumer *consumer) |
| Remove an external log consumer from the system logger. | |
| KANOOP_EXPORT LogLevel | parseLevel (const QString &value, bool *parsed=nullptr) |
| Parse a log level name string into a LogLevel enum value. | |
| KANOOP_EXPORT QDateTime | getLogStartTime (const QString &filename) |
| Read the start timestamp from an existing log file. | |
| KANOOP_EXPORT QDateTime | getLogEndTime (const QString &filename) |
| Read the end timestamp from an existing log file. | |
| KANOOP_EXPORT LogLevel | getLogLevel (const QString &levelName) |
| Look up a LogLevel by its name string. | |
| KANOOP_EXPORT QList< LogLevel > | getLogLevels () |
| Return a list of all defined LogLevel values. | |
| KANOOP_EXPORT QString | getLogLevelString (LogLevel level) |
| Return the name string for a LogLevel value. | |
Logging subsystem providing categorized, level-filtered output.
A single log entry carrying level, category, timestamp, and message text.
Logging subsystem namespace.
| enum Log::LogLevel |
Severity levels for log messages, ordered from most to least critical.
Mirrors the syslog severity levels. The active logger level acts as a threshold: messages with a value greater than the threshold are discarded.
Definition at line 26 of file loggingtypes.h.
| enum Log::OutputFlags |
Bitmask flags controlling where log output is sent.
Definition at line 41 of file loggingtypes.h.
| KANOOP_EXPORT void Log::addConsumer | ( | LogConsumer * | consumer | ) |
Add an external log consumer to the system logger.
| consumer | Consumer to add |
| KANOOP_EXPORT QList< LogCategory > Log::categories | ( | ) |
Return all categories registered with the system logger.
| KANOOP_EXPORT void Log::disableOutputFlags | ( | OutputFlags | flags | ) |
Disable specific output flags on the system logger.
| flags | Flags to disable |
| KANOOP_EXPORT void Log::enableOutputFlags | ( | OutputFlags | flags | ) |
Enable additional output flags on the system logger.
| flags | Flags to enable |
| KANOOP_EXPORT QString Log::filename | ( | ) |
Return the log file path of the system logger.
| KANOOP_EXPORT OutputFlags Log::flags | ( | ) |
Return the output flags of the system logger.
Referenced by Log::Logger::setFlags().
| KANOOP_EXPORT QDateTime Log::getLogEndTime | ( | const QString & | filename | ) |
Read the end timestamp from an existing log file.
| filename | Path to the log file |
| KANOOP_EXPORT LogLevel Log::getLogLevel | ( | const QString & | levelName | ) |
Look up a LogLevel by its name string.
| levelName | Name string (case-insensitive) |
| KANOOP_EXPORT QList< LogLevel > Log::getLogLevels | ( | ) |
Return a list of all defined LogLevel values.
| KANOOP_EXPORT QString Log::getLogLevelString | ( | LogLevel | level | ) |
Return the name string for a LogLevel value.
| level | LogLevel to convert |
| KANOOP_EXPORT QDateTime Log::getLogStartTime | ( | const QString & | filename | ) |
Read the start timestamp from an existing log file.
| filename | Path to the log file |
| KANOOP_EXPORT QString Log::identity | ( | ) |
Return the syslog identity of the system logger.
| KANOOP_EXPORT LogLevel Log::level | ( | ) |
Return the current minimum log level of the system logger.
Referenced by Log::LogEntry::LogEntry().
| KANOOP_EXPORT void Log::logHex | ( | const char * | file, |
| int | lineNumber, | ||
| LogLevel | level, | ||
| const LogCategory & | category, | ||
| const QByteArray & | data, | ||
| const QString & | tag = QString() |
||
| ) |
Write a categorized hex dump via the system logger.
| file | Source filename |
| lineNumber | Source line number |
| level | Severity level |
| category | Log category |
| data | Bytes to dump |
| tag | Optional label |
| KANOOP_EXPORT void Log::logHex | ( | const char * | file, |
| int | lineNumber, | ||
| LogLevel | level, | ||
| const QByteArray & | data, | ||
| const QString & | tag = QString() |
||
| ) |
Write a hex dump via the system logger.
| file | Source filename |
| lineNumber | Source line number |
| level | Severity level |
| data | Bytes to dump |
| tag | Optional label |
| KANOOP_EXPORT void Log::logText | ( | const char * | file, |
| int | lineNumber, | ||
| LogLevel | level, | ||
| const LogCategory & | category, | ||
| const QString & | text | ||
| ) |
Write a categorized text message via the system logger.
| file | Source filename |
| lineNumber | Source line number |
| level | Severity level |
| category | Log category |
| text | Message text |
| KANOOP_EXPORT void Log::logText | ( | const char * | file, |
| int | lineNumber, | ||
| LogLevel | level, | ||
| const QString & | text | ||
| ) |
Write a text message via the system logger.
| file | Source filename |
| lineNumber | Source line number |
| level | Severity level |
| text | Message text |
| KANOOP_EXPORT LogLevel Log::parseLevel | ( | const QString & | value, |
| bool * | parsed = nullptr |
||
| ) |
Parse a log level name string into a LogLevel enum value.
| value | String name (e.g. "debug", "error") |
| parsed | Optional output set to true if parsing succeeded |
| KANOOP_EXPORT LogCategory Log::registerCategory | ( | const QString & | name | ) |
Register a log category by name with the system logger.
| name | Category name |
| KANOOP_EXPORT LogCategory Log::registerCategory | ( | const QString & | name, |
| LogLevel | level | ||
| ) |
Register a log category by name and level with the system logger.
| name | Category name |
| level | Level override for this category |
| KANOOP_EXPORT void Log::removeConsumer | ( | LogConsumer * | consumer | ) |
Remove an external log consumer from the system logger.
| consumer | Consumer to remove |
| KANOOP_EXPORT void Log::setCategoryLevel | ( | const QString & | name, |
| LogLevel | level | ||
| ) |
Override the log level for a named category on the system logger.
| name | Category name |
| level | Level to apply |
| KANOOP_EXPORT void Log::setFilename | ( | const QString & | filename | ) |
Set the log file path of the system logger.
| filename | Path to the log file |
| KANOOP_EXPORT void Log::setFlags | ( | OutputFlags | flags | ) |
Set the output flags of the system logger.
| flags | New OutputFlags bitmask |
| KANOOP_EXPORT void Log::setIdentity | ( | const QString & | value | ) |
Set the syslog identity of the system logger.
| value | Identity string |
| KANOOP_EXPORT void Log::setLevel | ( | LogLevel | value | ) |
Set the minimum log level of the system logger.
| value | New LogLevel threshold |