org::xmlBlaster::util::Log Class Reference

Inheritance diagram for org::xmlBlaster::util::Log:

Inheritance graph
[legend]
Collaboration diagram for org::xmlBlaster::util::Log:

Collaboration graph
[legend]
List of all members.

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:.
PropertygetProperties ()

Detailed Description

Definition at line 26 of file Log.h.


Constructor & Destructor Documentation

org::xmlBlaster::util::Log::Log ( Property properties,
int  args = 0,
const char *const  argc[] = 0,
const std::string &  name = "default" 
)

org::xmlBlaster::util::Log::~Log (  ) 

Definition at line 79 of file Log.cpp.


Member Function Documentation

std::string org::xmlBlaster::util::Log::getName (  ) 

Return the log channel.

Definition at line 145 of file Log.h.

void org::xmlBlaster::util::Log::setWithXtermColor ( bool  val = true  ) 

Switch the colored logging output on or off.

Defaults on UNIX to 'on' and on Windows to 'off'

Definition at line 98 of file Log.cpp.

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  ) 

Sets the loglevel.

Definition at line 108 of file Log.cpp.

References setPreLogLevelCheck().

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.

Parameters:
for example "TRACE"

void org::xmlBlaster::util::Log::addLogLevel ( std::string  logLevel  ) 

Adds the loglevel.

Parameters:
for example "DUMP"

Referenced by initialize().

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".

Parameters:
bit setting for example L_TRACE
Returns:
for example "ERROR|WARN|TRACE"

std::string org::xmlBlaster::util::Log::getLogLevelStr (  )  const [virtual]

My current log level setting in human readable notation.

Returns:
for example "ERROR|WARN|TRACE"

Reimplemented from org::xmlBlaster::util::I_Log.

Definition at line 215 of file Log.h.

int org::xmlBlaster::util::Log::getLogLevel (  )  const

Gets the loglevel 0,10,20,30,40,50,60.

Definition at line 220 of file Log.h.

void org::xmlBlaster::util::Log::setLogFormat ( const std::string &  format  ) 

Definition at line 225 of file Log.h.

void org::xmlBlaster::util::Log::panic ( const std::string &  instance,
const std::string &  text 
) [virtual]

Use this exit for errors.

Reimplemented from org::xmlBlaster::util::I_Log.

void org::xmlBlaster::util::Log::exit ( const std::string &  instance,
const std::string &  text 
) [virtual]

Exit without errors.

Reimplemented from org::xmlBlaster::util::I_Log.

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]

Use this for internal xmlBlaster errors reporting.

Implements org::xmlBlaster::util::I_Log.

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]

Tracing execution.

Implements org::xmlBlaster::util::I_Log.

void org::xmlBlaster::util::Log::call ( const std::string &  instance,
const std::string &  text 
) [virtual]

Tracing when entering methods.

Implements org::xmlBlaster::util::I_Log.

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 (  ) 

Display some statistic on exit.

Definition at line 291 of file Log.cpp.

References info().

void org::xmlBlaster::util::Log::printStack (  ) 

Display the current stack
Very slow and not filtered for usefulness.

Definition at line 316 of file Log.cpp.

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 (  ) 

Definition at line 393 of file Log.cpp.

References org::xmlBlaster::util::I_Log::time().

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.

Parameters:
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"

Property& org::xmlBlaster::util::Log::getProperties (  ) 

Definition at line 340 of file Log.h.


The documentation for this class was generated from the following files: