|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Levelled console logging: verbose, debug and error printf-style output with per-subject filtering. More...
#include <memory.h>#include <stdio.h>#include <stdarg.h>Go to the source code of this file.
Namespaces | |
| namespace | cmlabs |
Macros | |
Console subjects | |
Subject identifiers used as the first argument to PrintVerbose() and PrintDebug(). They partition log output by architectural layer. | |
| #define | CONSOLE_SYSTEM 1 |
| System-wide events (startup, shutdown, configuration). | |
| #define | CONSOLE_NETWORK 2 |
| Networking layer (sockets, protocols, connections). | |
| #define | CONSOLE_NODE 3 |
| Node-level events in a distributed system. | |
| #define | CONSOLE_PROCESS 4 |
| OS process management events. | |
| #define | CONSOLE_COMPONENT 5 |
| Individual component/module events. | |
| #define | CONSOLE_COUNT 5 |
| Number of defined subjects (array sizes below). | |
Functions | |
| bool | cmlabs::SetDebugLevel (unsigned char level) |
| Set the debug level for all subjects at once. | |
| bool | cmlabs::SetDebugLevel (unsigned char subject, unsigned char level) |
| Set the debug level for a single subject. | |
| bool | cmlabs::SetVerboseLevel (unsigned char level) |
| Set the verbose level for all subjects at once. | |
| bool | cmlabs::SetVerboseLevel (unsigned char subject, unsigned char level) |
| Set the verbose level for a single subject. | |
| bool | cmlabs::SetErrorLevel (unsigned char level) |
| Set the global error output level. | |
| bool | cmlabs::PrintFile (FILE *stream, const char *formatstring,...) |
| Print a printf-style formatted string to an arbitrary stdio stream. | |
| bool | cmlabs::PrintVerbose (unsigned char subject, unsigned char level, const char *formatstring,...) |
| Print a verbose (informational) message if enabled for the subject. | |
| bool | cmlabs::PrintError (unsigned char level, const char *formatstring,...) |
| Print an error message if enabled. | |
| bool | cmlabs::PrintDebug (unsigned char subject, unsigned char level, const char *formatstring,...) |
| Print a debug message if enabled for the subject. | |
Variables | |
| static const char * | cmlabs::VerboseSubjects [] = { "verbose-system", "verbose-network", "verbose-node", "verbose-process", "verbose-component" } |
| Spec attribute names for per-subject verbose levels, indexed by subject-1. | |
| static const char * | cmlabs::DebugSubjects [] = { "debug-system", "debug-network", "debug-node", "debug-process", "debug-component" } |
| Spec attribute names for per-subject debug levels, indexed by subject-1. | |
| static unsigned char | cmlabs::VerboseLevel [5] = {1,1,1,1,1} |
| Current verbose level per subject (index = subject-1). | |
| static unsigned char | cmlabs::DebugLevel [5] = {0,0,0,0,0} |
| Current debug level per subject (index = subject-1). | |
| static unsigned char | cmlabs::ErrorLevel = 1 |
| Current error level threshold. | |
Levelled console logging: verbose, debug and error printf-style output with per-subject filtering.
This header defines the CMSDK-wide console logging facility used by every subsystem (networking, nodes, processes, components). Output is split into three severities — verbose, debug and error — and further partitioned into five subjects (CONSOLE_SYSTEM .. CONSOLE_COMPONENT) so that, for example, network tracing can be turned up without flooding the console with component chatter. Each subject carries an independent numeric level; a message is printed only when its level is less than or equal to the currently configured level for its subject.
The level tables (::VerboseLevel, ::DebugLevel, ::ErrorLevel) are defined static in this header, meaning each translation unit that includes it gets its own copy; the Set*Level() functions defined in ConsoleOutput.cpp operate on the copies visible in that translation unit. Levels are typically driven from a system specification (see the verbose-system / debug-network etc. names in ::VerboseSubjects and ::DebugSubjects, which match spec attribute names).
Definition in file ConsoleOutput.h.
| #define CONSOLE_COMPONENT 5 |
Individual component/module events.
Definition at line 40 of file ConsoleOutput.h.
| #define CONSOLE_COUNT 5 |
Number of defined subjects (array sizes below).
Definition at line 41 of file ConsoleOutput.h.
Referenced by cmlabs::SetDebugLevel(), cmlabs::SetDebugLevel(), cmlabs::SetVerboseLevel(), and cmlabs::SetVerboseLevel().
| #define CONSOLE_NETWORK 2 |
Networking layer (sockets, protocols, connections).
Definition at line 37 of file ConsoleOutput.h.
| #define CONSOLE_NODE 3 |
Node-level events in a distributed system.
Definition at line 38 of file ConsoleOutput.h.
| #define CONSOLE_PROCESS 4 |
OS process management events.
Definition at line 39 of file ConsoleOutput.h.
| #define CONSOLE_SYSTEM 1 |
System-wide events (startup, shutdown, configuration).
Definition at line 36 of file ConsoleOutput.h.