CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
ConsoleOutput.h
Go to the documentation of this file.
1
23#if !defined(_CONSOLEOUTPUT_H_)
24#define _CONSOLEOUTPUT_H_
25
26#include <memory.h>
27#include <stdio.h>
28#include <stdarg.h>
29
30namespace cmlabs{
31
36#define CONSOLE_SYSTEM 1
37#define CONSOLE_NETWORK 2
38#define CONSOLE_NODE 3
39#define CONSOLE_PROCESS 4
40#define CONSOLE_COMPONENT 5
41#define CONSOLE_COUNT 5
43
45static const char *VerboseSubjects[] = { "verbose-system", "verbose-network", "verbose-node", "verbose-process", "verbose-component" };
47static const char *DebugSubjects[] = { "debug-system", "debug-network", "debug-node", "debug-process", "debug-component" };
49static unsigned char VerboseLevel[5] = {1,1,1,1,1};
51static unsigned char DebugLevel[5] = {0,0,0,0,0};
53static unsigned char ErrorLevel = 1;
54
58bool SetDebugLevel(unsigned char level);
63bool SetDebugLevel(unsigned char subject, unsigned char level);
67bool SetVerboseLevel(unsigned char level);
72bool SetVerboseLevel(unsigned char subject, unsigned char level);
76bool SetErrorLevel(unsigned char level);
77
85bool PrintFile(FILE* stream, const char *formatstring, ... );
91bool PrintVerbose(unsigned char subject, unsigned char level, const char *formatstring, ... );
96bool PrintError(unsigned char level, const char *formatstring, ... );
102bool PrintDebug(unsigned char subject, unsigned char level, const char *formatstring, ... );
103
104}
105
106#endif //_CONSOLEOUTPUT_H_
107
static const char * VerboseSubjects[]
Spec attribute names for per-subject verbose levels, indexed by subject-1.
static const char * DebugSubjects[]
Spec attribute names for per-subject debug levels, indexed by subject-1.
bool SetDebugLevel(unsigned char level)
Set the debug level for all subjects at once.
bool PrintError(unsigned char level, const char *formatstring,...)
Print an error message if enabled.
bool SetVerboseLevel(unsigned char level)
Set the verbose level for all subjects at once.
bool PrintVerbose(unsigned char subject, unsigned char level, const char *formatstring,...)
Print a verbose (informational) message if enabled for the subject.
static unsigned char ErrorLevel
Current error level threshold.
bool PrintDebug(unsigned char subject, unsigned char level, const char *formatstring,...)
Print a debug message if enabled for the subject.
static unsigned char VerboseLevel[5]
Current verbose level per subject (index = subject-1).
bool PrintFile(FILE *stream, const char *formatstring,...)
Print a printf-style formatted string to an arbitrary stdio stream.
bool SetErrorLevel(unsigned char level)
Set the global error output level.
static unsigned char DebugLevel[5]
Current debug level per subject (index = subject-1).