Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

LobTraceProvider Class Reference

Trace server. More...

#include <lobtracestream.h>

List of all members.

Public Types

enum  traceLevels {
  InOut = 0, Debug, Trace, Warning,
  Error, Critical, Exception
}
 traceLevels to be used for eachg trace. More...


Public Methods

 LobTraceProvider ()
virtual ~LobTraceProvider ()
void initialize (const char *confFilename, const char *logFilePrefix)
 Reads LobTrace config file to set module trace-levels. More...

virtual void onTrace (LobTraceStream &param)
 formats & writes a trace message to the output Stream. More...

void setModuleTraceLevel (int moduleId, int level)
 Set trace level for the given module. More...

bool isTraced (int module, int level)
 Returns if yes(true) or no, this trace is to be taken in consideration. More...

bool isTraced (int module, traceLevels level)
 Returns if yes(true) or no, this trace is to be taken in consideration. More...

const char * getLogFilename ()
const bool isXmlTrace ()
virtual void dump ()
 writes a complete XML description of this instance to cout. More...


Friends

ostream & operator<< (ostream &os, LobTraceProvider &ltp)
 Provides a formated description of this LobTraceProvider instance. More...


Detailed Description

Trace server.

A LobTraceProvider instance will write a LobTraceStream to a file (or any other output, like cout).

Before beeing written to a file, the LobTraceStream will be checked, to see if its traceLevel is allowed to be logged (module, traceLevel).
The message will then be formatted (date, time, ...) and written to the output stream.


Member Enumeration Documentation

enum LobTraceProvider::traceLevels
 

traceLevels to be used for eachg trace.

Todo:
use this instead of define U_TRA_INOUT, ...

A traceLevel has to be specified for each trace you add in your code.
The LobTraceProvider will then decide if yes or no this trace is to be logged.

Enumeration values:
InOut 
Debug 
Trace 
Warning 
Error 
Critical 
Exception 


Constructor & Destructor Documentation

LobTraceProvider::LobTraceProvider  
 

LobTraceProvider::~LobTraceProvider   [virtual]
 

Todo:
as it is not oppened in the constructor, m_traceFile should not be closed in here.


Member Function Documentation

void LobTraceProvider::dump   [virtual]
 

writes a complete XML description of this instance to cout.

const char* LobTraceProvider::getLogFilename   [inline]
 

void LobTraceProvider::initialize const char *    confFilename,
const char *    logFilePrefix
 

Reads LobTrace config file to set module trace-levels.

This method will read the confFilename config file to set the trace level for each module of your application.
If confFilename is NULL, then "lobtrace.ini" is searched. If confFilename does not exist, then traces are redirected to standard output (cout).

Trace outputs are written in a file which name begins with logFilePrefix. if NULL, then trace filenames will start with "lobtrace_"

Remarks:
It is not mandatory to initialize a LobTraceProvider.
if not initialized, traces are redirected to standard output (cout) and the modules tracelevels are those specified in the constructor.

bool LobTraceProvider::isTraced int    module,
traceLevels    level
 

Returns if yes(true) or no, this trace is to be taken in consideration.

All tracelevels that are >= to the one specified for the given module are traced. the others are not logged.

example:
If tracelevel for module UTILS is set to WARNING, then all traces arriving with level WARNING, DEBUG and CRITICAL are logged. INOUT, TRACE and DEBUG are rejected.

bool LobTraceProvider::isTraced int    module,
int    level
 

Returns if yes(true) or no, this trace is to be taken in consideration.

All tracelevels that are >= to the one specified for the given module are traced. the others are not logged.

example:
If tracelevel for module UTILS is set to WARNING, then all traces arriving with level WARNING, ERROR and CRITICAL are logged. INOUT, TRACE and DEBUG are rejected.

Todo:
to be removed once traceLevels ok

const bool LobTraceProvider::isXmlTrace   [inline]
 

void LobTraceProvider::onTrace LobTraceStream   param [virtual]
 

formats & writes a trace message to the output Stream.

A new LobTraceStream needs to be logged, this method formats the message and prints it to the output stream (file/cout)

Parameters:
param  IN stream to log

void LobTraceProvider::setModuleTraceLevel int    moduleId,
int    level
 

Set trace level for the given module.

Trace Levels are: INOUT, TRACE, DEBUG, WARNING, ERROR and CRITICAL

If tracelevel is set to WARNING,
then all traces arriving with level WARNING, DEBUG and CRITICAL are logged. INOUT, TRACE and DEBUG are rejected.


Friends And Related Function Documentation

ostream& operator<< ostream &    os,
LobTraceProvider &    ltp
[friend]
 

Provides a formated description of this LobTraceProvider instance.


The documentation for this class was generated from the following files:
Generated on Sun Dec 15 23:17:21 2002 for LobTraceStream by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001