|
CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
|
Process-wide singleton logging hub with per-topic verbosity/debug levels. More...
#include <Utils.h>
Public Member Functions | |
| LogSystem () | |
| ~LogSystem () | |
Static Public Member Functions | |
| static bool | SetLogReceiver (LogReceiver *rec) |
| Register a receiver that gets every accepted LogEntry. | |
| static bool | SetLogFileOutput (const char *logfile, bool printOut=true) |
| Direct log output to a file. | |
| static bool | SetLogLevelDebug (uint8 level) |
| Set the debug level threshold for all topics. | |
| static bool | SetLogLevelDebug (uint8 subject, uint8 level) |
| Set the debug level threshold for one topic. | |
| static bool | SetLogLevelVerbose (uint8 level) |
| Set the verbose (print) level threshold for all topics. | |
| static bool | SetLogLevelVerbose (uint8 subject, uint8 level) |
| Set the verbose (print) level threshold for one topic. | |
| static bool | LogSystemPrint (uint32 source, uint8 subject, uint8 level, const char *formatstring,...) |
| printf-style informational logging (usually invoked via the LogPrint macro). | |
| static bool | LogSystemDebug (uint32 source, uint8 subject, uint8 level, const char *formatstring,...) |
| printf-style debug logging (usually invoked via the LogDebug macro); same parameters as LogSystemPrint() but gated on the debug thresholds. | |
Public Attributes | |
| uint8 | logLevelVerbose [LOG_MAXCOUNT] |
| uint8 | logLevelDebug [LOG_MAXCOUNT] |
| LogReceiver * | logReceiverObj |
| char * | logfile |
| bool | printToStdOut |
Static Public Attributes | |
| static LogSystem * | LogSingleton = NULL |
| Lazily-created global instance used by all static functions. | |
Process-wide singleton logging hub with per-topic verbosity/debug levels.
Log calls go through the LogPrint / LogDebug macros which forward to the static LogSystemPrint()/LogSystemDebug() printf-style entry points. Output can go to stdout, a file, and/or a registered LogReceiver. Topics (subjects) are the LOG_* constants above; each has independent verbose and debug level thresholds.
| cmlabs::LogSystem::LogSystem | ( | ) |
Definition at line 242 of file Utils.cpp.
References logfile, and printToStdOut.
Referenced by LogSystemDebug(), LogSystemPrint(), SetLogFileOutput(), SetLogLevelDebug(), SetLogLevelDebug(), SetLogLevelVerbose(), SetLogLevelVerbose(), and SetLogReceiver().
| cmlabs::LogSystem::~LogSystem | ( | ) |
Definition at line 246 of file Utils.cpp.
References logfile, and printToStdOut.
|
static |
printf-style debug logging (usually invoked via the LogDebug macro); same parameters as LogSystemPrint() but gated on the debug thresholds.
Definition at line 367 of file Utils.cpp.
References cmlabs::LogEntry::cid, cmlabs::GetTimeNow(), cmlabs::LogEntry::level, LOG_MAXCOUNT, LOGDEBUG, LOGENTRYID, LogSingleton, LogSystem(), cmlabs::PrintTimeNowString(), cmlabs::LogEntry::setText(), cmlabs::LogEntry::size, cmlabs::LogEntry::source, cmlabs::utils::StringFormatVA(), cmlabs::LogEntry::subject, cmlabs::LogEntry::time, and cmlabs::LogEntry::type.
Referenced by _wrap_LogSystem_LogSystemDebug__varargs__().
|
static |
printf-style informational logging (usually invoked via the LogPrint macro).
| source | Numeric id of the logging component. |
| subject | LOG_* topic. |
| level | Importance; emitted when <= the topic's verbose threshold. |
| formatstring | printf format followed by matching varargs. |
Definition at line 319 of file Utils.cpp.
References cmlabs::utils::AppendToAFile(), cmlabs::LogEntry::cid, cmlabs::GetTimeNow(), cmlabs::LogEntry::level, LOG_MAXCOUNT, LOGENTRYID, LOGPRINT, LogSingleton, LogSystem(), cmlabs::PrintTimeNowString(), cmlabs::LogEntry::setText(), cmlabs::LogEntry::size, cmlabs::LogEntry::source, cmlabs::utils::StringFormat(), cmlabs::utils::StringFormatVA(), cmlabs::LogEntry::subject, cmlabs::LogEntry::time, and cmlabs::LogEntry::type.
Referenced by _wrap_LogSystem_LogSystemPrint__varargs__().
|
static |
Direct log output to a file.
| logfile | Path of the log file to append to. |
| printOut | Also keep printing to stdout when true. |
Definition at line 288 of file Utils.cpp.
References LOG_MAXCOUNT, logfile, LogSingleton, LogSystem(), and cmlabs::utils::strcpyavail().
Referenced by _wrap_LogSystem_SetLogFileOutput__SWIG_0(), and _wrap_LogSystem_SetLogFileOutput__SWIG_1().
|
static |
Set the debug level threshold for all topics.
| level | Messages with level <= this are emitted. |
Definition at line 193 of file Utils.cpp.
References LOG_MAXCOUNT, LogSingleton, and LogSystem().
Referenced by _wrap_LogSystem_SetLogLevelDebug__SWIG_0(), and _wrap_LogSystem_SetLogLevelDebug__SWIG_1().
|
static |
Set the debug level threshold for one topic.
| subject | LOG_* topic id. |
| level | Threshold. |
Definition at line 204 of file Utils.cpp.
References LOG_MAXCOUNT, LogSingleton, and LogSystem().
|
static |
Set the verbose (print) level threshold for all topics.
| level | Threshold. |
Definition at line 217 of file Utils.cpp.
References LOG_MAXCOUNT, LogSingleton, and LogSystem().
Referenced by _wrap_LogSystem_SetLogLevelVerbose__SWIG_0(), and _wrap_LogSystem_SetLogLevelVerbose__SWIG_1().
|
static |
Set the verbose (print) level threshold for one topic.
| subject | LOG_* topic id. |
| level | Threshold. |
Definition at line 228 of file Utils.cpp.
References LOG_MAXCOUNT, LogSingleton, and LogSystem().
|
static |
Register a receiver that gets every accepted LogEntry.
| rec | Receiver (not owned). |
Definition at line 182 of file Utils.cpp.
References LOG_MAXCOUNT, LogSingleton, and LogSystem().
Referenced by _wrap_LogSystem_SetLogReceiver(), and cmlabs::PsySpace::reset().
| char* cmlabs::LogSystem::logfile |
Definition at line 309 of file Utils.h.
Referenced by _wrap_LogSystem_logfile_set(), LogSystem(), SetLogFileOutput(), and ~LogSystem().
| uint8 cmlabs::LogSystem::logLevelDebug[LOG_MAXCOUNT] |
Definition at line 307 of file Utils.h.
Referenced by _wrap_LogSystem_logLevelDebug_set().
| uint8 cmlabs::LogSystem::logLevelVerbose[LOG_MAXCOUNT] |
Definition at line 306 of file Utils.h.
Referenced by _wrap_LogSystem_logLevelVerbose_set().
| LogReceiver* cmlabs::LogSystem::logReceiverObj |
|
static |
Lazily-created global instance used by all static functions.
Definition at line 278 of file Utils.h.
Referenced by LogSystemDebug(), LogSystemPrint(), SetLogFileOutput(), SetLogLevelDebug(), SetLogLevelDebug(), SetLogLevelVerbose(), SetLogLevelVerbose(), SetLogReceiver(), Swig_var_LogSystem_LogSingleton_get(), Swig_var_LogSystem_LogSingleton_set(), and cmlabs::CleanShutdown::~CleanShutdown().
| bool cmlabs::LogSystem::printToStdOut |
Definition at line 310 of file Utils.h.
Referenced by LogSystem(), and ~LogSystem().