cisst-saw
|
Class to glue the class register, the output multiplexer and the message level of detail to form the logging entity of cisst. More...
#include <cmnLogger.h>
Public Types | |
typedef cmnLODMultiplexerStreambuf < char > | StreamBufType |
Static Public Member Functions | |
static cmnLogger * | Instance (void) |
static void | SetMask (cmnLogMask mask) |
static void CISST_DEPRECATED | SetLoD (cmnLogMask mask) |
static cmnLogMask | GetMask (void) |
static cmnLogMask CISST_DEPRECATED | GetLoD (void) |
static void | SetMaskFunction (cmnLogMask mask) |
static cmnLogMask | GetMaskFunction (void) |
static bool | SetMaskClass (const std::string &className, cmnLogMask mask) |
static bool | SetMaskClassAll (cmnLogMask mask) |
static bool | SetMaskClassMatching (const std::string &stringToMatch, cmnLogMask mask) |
static StreamBufType * | GetMultiplexer (void) |
static void | HaltDefaultLog (void) |
static void | ResumeDefaultLog (cmnLogMask newLoD=CMN_LOG_ALLOW_DEFAULT) |
static void | SetMaskDefaultLog (cmnLogMask newLoD=CMN_LOG_ALLOW_DEFAULT) |
static void | AddChannel (std::ostream &outputStream, cmnLogMask mask=CMN_LOG_ALLOW_ALL) |
static void | AddChannelToStdOut (cmnLogMask mask=CMN_LOG_ALLOW_ERRORS_AND_WARNINGS) |
static void | AddChannelToStdErr (cmnLogMask mask=CMN_LOG_ALLOW_ERRORS_AND_WARNINGS) |
static void | RemoveChannel (std::ostream &outputStream) |
static const char * | ExtractFileName (const char *file) |
static void | Kill (void) |
Protected Member Functions | |
cmnLogger (const std::string &defaultLogFileName="cisstLog.txt") | |
Class to glue the class register, the output multiplexer and the message level of detail to form the logging entity of cisst.
cmnLogger is defined as a singleton, i.e. there is only one instance of cmnLogger. This unique object maintains the data required for the cisst logging system. The design of the logging system relies on:
To filter the messages, the user can use:
typedef cmnLODMultiplexerStreambuf<char> cmnLogger::StreamBufType |
Type used to define the logging level of detail.
|
protected |
Constructor. The only constructor must be private in order to ensure that the class register is a singleton.
|
inlinestatic |
Add an output stream to the logger. The level of detail provided is used to filter the messages, i.e. any message with a level of detail higher than the level associated to the output stream will not be streamed.
|
inlinestatic |
Add std::cerr output stream to the logger. Useful when calling from Python, where redirecting sys.stderr to std::cerr is nontrivial.
|
inlinestatic |
Add std::cout output stream to the logger. Useful when calling from Python, where redirecting sys.stdout to std::cout is nontrivial.
|
static |
|
inlinestatic |
|
inlinestatic |
Get the global mask used to filter the log messages.
|
inlinestatic |
Get the function mask used to filter the log messages.
|
inlinestatic |
Returns the cmnLODMultiplexerStreambuf directly. This allows manipulation of the streambuffer for operations such as adding or deleting channels for the stream..
|
inlinestatic |
Disable the default log file "cisstLog.txt". This method removes the default log from the output list of the multiplexer but doesn't close the default log file.
|
static |
The log is instantiated as a singleton. To access the unique instantiation, one needs to use this static method. The instantiated log is created at the first call of this method since it is a static variable declared in this method's scope.
|
inlinestatic |
Kill the logger. Set all masks to disable logs and remove all output streams.
|
inlinestatic |
|
inlinestatic |
Resume the default log file. By default, the log is enabled (this is the default behavior of the cmnLogger constructor) but this can be halted by using HaltDefaultLog(). Using ResumeDefaultLog() allows to resume the log to "cisstLog.txt" without losing previous logs.
|
inlinestatic |
|
inlinestatic |
Set the global mask used to filter the log messages.
mask | The overall mask used to filter the log. |
|
static |
Specify the log mask for a specific class. See cmnClassRegister::SetLogMaskClass.
className | The name of the class |
mask | The log mask to be applied |
|
static |
Specify the log mask for all registered classes. See cmnClassRegister::SetLogMaskClassAll.
mask | The log mask to be applied |
|
static |
Specify the log mask for all classes with a name matching a given string. See cmnClassRegister::SetLogMaskClassMatching.
stringToMatch | A string found in class names (e.g. "cmn") |
mask | The log mask to be applied |
|
inlinestatic |
Set a new mask for the default log file. This method uses HaltDefaultLog followed by ResumeDefaultLog.
|
inlinestatic |
Set the "function" mask used to filter the log messages.
mask | The function mask used to filter the log. |