Public Member Functions | |
std::string | getName () |
Return the log channel. | |
Log (Property &properties, int args=0, const char *const argc[]=0, const std::string &name="default") | |
~Log () | |
void | setWithXtermColor (bool val=true) |
Switch the colored logging output on or off. | |
void | setDefaultLogLevel () |
Sets the default loglevel L_PANIC | L_ERROR | L_WARN | L_INFO. | |
void | setLogLevel (int level) |
Sets the loglevel. | |
void | setLogLevel (int argc, const char *const args[]) |
Set logging level from start parameter and initialize properties. | |
void | removeLogLevel (std::string logLevel) |
Removes the loglevel. | |
void | addLogLevel (std::string logLevel) |
Adds the loglevel. | |
void | setPreLogLevelCheck () |
Set the boolean values of CALL, TIME, TRACE, DUMP accordingly. | |
std::string | bitToLogLevel (int level) const |
Converts for example the bit setting L_ERROR to String "ERROR|WARN". | |
std::string | getLogLevelStr () const |
My current log level setting in human readable notation. | |
int | getLogLevel () const |
Gets the loglevel 0,10,20,30,40,50,60. | |
void | setLogFormat (const std::string &format) |
void | panic (const std::string &instance, const std::string &text) |
Use this exit for errors. | |
void | exit (const std::string &instance, const std::string &text) |
Exit without errors. | |
void | info (const std::string &instance, const std::string &text) |
Use this for normal logging output. | |
void | warn (const std::string &instance, const std::string &text) |
Use this for logging output where the xmlBlaster administrator shall be informed for example a login denied event. | |
void | error (const std::string &instance, const std::string &text) |
Use this for internal xmlBlaster errors reporting. | |
void | plain (const std::string &instance, const std::string &text) |
void | dump (const std::string &instance, const std::string &text) |
void | trace (const std::string &instance, const std::string &text) |
Tracing execution. | |
void | call (const std::string &instance, const std::string &text) |
Tracing when entering methods. | |
void | time (const std::string &instance, const std::string &text) |
Output of performant measurements (elapsed milliseconds). | |
virtual std::string | usage () const |
Command line usage. | |
void | displayStatistics () |
Display some statistic on exit. | |
void | printStack () |
Display the current stack Very slow and not filtered for usefulness. | |
void | initialize () |
Force setting logging properties from xmlBlaster.properties. | |
std::string | getTime () |
void | log (const std::string &levelStr, int level, const std::string &instance, const std::string &text) |
Log example:. | |
Property & | getProperties () |
Definition at line 26 of file Log.h.
org::xmlBlaster::util::Log::Log | ( | Property & | properties, | |
int | args = 0 , |
|||
const char *const | argc[] = 0 , |
|||
const std::string & | name = "default" | |||
) |
std::string org::xmlBlaster::util::Log::getName | ( | ) |
void org::xmlBlaster::util::Log::setWithXtermColor | ( | bool | val = true |
) |
void org::xmlBlaster::util::Log::setDefaultLogLevel | ( | ) |
Sets the default loglevel L_PANIC | L_ERROR | L_WARN | L_INFO.
Definition at line 102 of file Log.cpp.
References setPreLogLevelCheck().
void org::xmlBlaster::util::Log::setLogLevel | ( | int | level | ) |
void org::xmlBlaster::util::Log::setLogLevel | ( | int | argc, | |
const char *const | args[] | |||
) |
Set logging level from start parameter and initialize properties.
Example:
jaco org.xmlBlaster.Main -trace true -dump true -call true -dump true
void org::xmlBlaster::util::Log::removeLogLevel | ( | std::string | logLevel | ) |
Removes the loglevel.
for | example "TRACE" |
void org::xmlBlaster::util::Log::addLogLevel | ( | std::string | logLevel | ) |
void org::xmlBlaster::util::Log::setPreLogLevelCheck | ( | ) |
Set the boolean values of CALL, TIME, TRACE, DUMP accordingly.
This allows to use 'if (Log.trace())' in your code, so that the following Log.trace(...) is not executed if not needed (performance gain).
Definition at line 138 of file Log.cpp.
References org::xmlBlaster::util::I_Log::call_, org::xmlBlaster::util::I_Log::dump_, org::xmlBlaster::util::I_Log::time_, and org::xmlBlaster::util::I_Log::trace_.
Referenced by initialize(), setDefaultLogLevel(), and setLogLevel().
std::string org::xmlBlaster::util::Log::bitToLogLevel | ( | int | level | ) | const |
Converts for example the bit setting L_ERROR to String "ERROR|WARN".
bit | setting for example L_TRACE |
std::string org::xmlBlaster::util::Log::getLogLevelStr | ( | ) | const [virtual] |
My current log level setting in human readable notation.
Reimplemented from org::xmlBlaster::util::I_Log.
int org::xmlBlaster::util::Log::getLogLevel | ( | ) | const |
void org::xmlBlaster::util::Log::setLogFormat | ( | const std::string & | format | ) |
void org::xmlBlaster::util::Log::panic | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
void org::xmlBlaster::util::Log::exit | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
void org::xmlBlaster::util::Log::info | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
Use this for normal logging output.
Implements org::xmlBlaster::util::I_Log.
Referenced by displayStatistics().
void org::xmlBlaster::util::Log::warn | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
Use this for logging output where the xmlBlaster administrator shall be informed
for example a login denied event.
Implements org::xmlBlaster::util::I_Log.
void org::xmlBlaster::util::Log::error | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
void org::xmlBlaster::util::Log::plain | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
Reimplemented from org::xmlBlaster::util::I_Log.
void org::xmlBlaster::util::Log::dump | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
Reimplemented from org::xmlBlaster::util::I_Log.
void org::xmlBlaster::util::Log::trace | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
void org::xmlBlaster::util::Log::call | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
void org::xmlBlaster::util::Log::time | ( | const std::string & | instance, | |
const std::string & | text | |||
) | [virtual] |
Output of performant measurements (elapsed milliseconds).
Reimplemented from org::xmlBlaster::util::I_Log.
virtual std::string org::xmlBlaster::util::Log::usage | ( | ) | const [virtual] |
Command line usage.
These variables may be set in xmlBlaster.properties as well. Don't use the "-" or "+" prefix there.
Reimplemented from org::xmlBlaster::util::I_Log.
void org::xmlBlaster::util::Log::displayStatistics | ( | ) |
void org::xmlBlaster::util::Log::printStack | ( | ) |
void org::xmlBlaster::util::Log::initialize | ( | ) |
Force setting logging properties from xmlBlaster.properties.
Called from Property after reading xmlBlaster.properties
Definition at line 338 of file Log.cpp.
References addLogLevel(), org::xmlBlaster::util::Property::getBoolProperty(), org::xmlBlaster::util::Property::getStringProperty(), and setPreLogLevelCheck().
string org::xmlBlaster::util::Log::getTime | ( | ) |
void org::xmlBlaster::util::Log::log | ( | const std::string & | levelStr, | |
int | level, | |||
const std::string & | instance, | |||
const std::string & | text | |||
) |
Log example:.
Feb 11, 2000 3:44:48 PM INFO : [Main] xmlBlaster is ready for requests.
levelStr | e.g. "WARNING" or "INFO" or null | |
level | for performance reasons, an int for the levelStr | |
instance | e.g. "RequestBroker" or "Authentication" | |
text | e.g. "Login denied" |