PcapPlusPlus
21.05
|
#include <Logger.h>
Public Types | |
enum | LogLevel { Normal, Debug } |
Public Member Functions | |
void | setLogLevel (LogModule module, LogLevel level) |
void | setAllModlesToLogLevel (LogLevel level) |
bool | isDebugEnabled (LogModule module) const |
const LogLevel * | getLogModulesArr () const |
bool | isErrorStringSet () const |
char * | getErrorString () const |
void | setErrorString (char *errString, int len) |
int | getErrorStringLength () const |
void | suppressErrors () |
void | enableErrors () |
bool | isSuppressErrors () const |
Static Public Member Functions | |
static LoggerPP & | getInstance () |
The PcapPlusPlus log manager class. PcapPlusPlus uses this logger to output both error and debug logs.
Debug logs: PcapPlusPlus is divided into modules (described in LogModule enum). The user can set each module or all modules to output or suppress debug messages. The default is suppressing debug messages. Changing debug log level for modules can be done dynamically while application is running.
Error logs: errors are printed by default to stderr. The user can change this behavior in several manners:
PcapPlusPlus logger is a singleton which can be reached from anywhere in the code *
|
inline |
Enable all errors in all PcapPlusPlusModules
|
inline |
Get the pointer to the error string set by the user. If no such pointer was provided by the user, NULL will be returned
|
inline |
Get the user-defined error string length. If no such pointer was provided by the user, 0 will be returned
|
inlinestatic |
|
inline |
Get an array that contains log level information for all modules. User can access this array with a certain PcapPlusPlus module and get the log level this module is currently in. For example: LogLevel* myLogLevelArr = getLogModulesArr(); if (myLogLevelArr[PacketLogModuleUdpLayer] == LogLevel::Debug) ....
|
inline |
Check whether a certain module is set to debug log level
[in] | module | PcapPlusPlus module |
|
inline |
Check whether error string was already set
|
inline |
Get an indication if errors are currently suppressed
|
inline |
Set all PcapPlusPlus modules to a certain log leve
[in] | level | The log level to set all modules to |
|
inline |
Set the error string to a string pointer provided by the user. By default all errors are printed to stderr. Using this method will cause PcapPlusPlus to output errors to the user string instead
[in] | errString | A string pointer provided by the user which all error messages will be print to from now on |
[in] | len | The length of errString array. If |
Set the log level for a certain PcapPlusPlus module
[in] | module | PcapPlusPlus module |
[in] | level | The log level to set the module to |
|
inline |
Suppress all errors in all PcapPlusPlusModules