|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CLog Class ReferenceWhen display() is called, the logger builds a string a sends it to its attached displayers.
More...
#include <log.h>
Inheritance diagram for NLMISC::CLog:
List of all members.
Public Types |
enum | TLogType {
LOG_NO = 0,
LOG_ERROR,
LOG_WARNING,
LOG_INFO,
LOG_DEBUG,
LOG_STAT,
LOG_ASSERT,
LOG_UNKNOWN
} |
Public Methods |
| CLog (TLogType logType=LOG_NO) |
void | addDisplayer (IDisplayer *displayer, bool bypassFilter=false) |
| Add a new displayer in the log. You have to create the displayer, remove it and delete it when you have finish with it. For example, in a 3dDisplayer, you can add the displayer when you want, and the displayer displays the string if the 3d screen is available and do nothing otherwise. In this case, if you want, you could leave the displayer all the time. More...
|
IDisplayer * | getDisplayer (const char *displayerName) |
| Return the first displayer selected by his name. More...
|
void | removeDisplayer (IDisplayer *displayer) |
| Remove a displayer. If the displayer doesn't work in a specific time, you could remove it. More...
|
void | removeDisplayer (const char *displayerName) |
| Remove a displayer using his name. More...
|
bool | attached (IDisplayer *displayer) const |
| Returns true if the specified displayer is attached to the log object. More...
|
bool | noDisplayer () const |
| Returns true if no displayer is attached. More...
|
void | setPosition (sint line, char *fileName) |
| If !noDisplayer(), sets line and file parameters, and enters the mutex. If !noDisplayer(), don't forget to call display...() after, to release the mutex. More...
|
void | displayNL (const char *format,...) |
| Display a string in decorated and final new line form to all attached displayers. Call setPosition() before. Releases the mutex. More...
|
void | display (const char *format,...) |
| Display a string in decorated form to all attached displayers. Call setPosition() before. Releases the mutex. More...
|
void | displayRawNL (const char *format,...) |
| Display a string with a final new line to all attached displayers. Call setPosition() before. Releases the mutex. More...
|
void | displayRaw (const char *format,...) |
| Display a string (and nothing more) to all attached displayers. Call setPosition() before. Releases the mutex. More...
|
void | forceDisplayRaw (const char *format,...) |
| Display a raw text to the normal displayer but without filtering It's used by the Memdisplayer (little hack to work). More...
|
void | addPositiveFilter (const char *filterstr) |
| Adds a positive filter. Tells the logger to log only the lines that contain filterstr. More...
|
void | addNegativeFilter (const char *filterstr) |
| Adds a negative filter. Tells the logger to discard the lines that contain filterstr. More...
|
void | resetFilters () |
| Reset both filters. More...
|
void | removeFilter (const char *filterstr=NULL) |
| Removes a filter by name (in both filters). More...
|
void | displayFilter (CLog &log) |
| Displays the list of filter into a log. More...
|
Static Public Methods |
void | setProcessName (const std::string &processName) |
| Set the name of the process. More...
|
void | setDefaultProcessName () |
| Find the process name if nobody call setProcessName before. More...
|
Protected Types |
typedef std::list< IDisplayer * > | CDisplayers |
Protected Methods |
void | unsetPosition () |
| Symetric to setPosition(). Automatically called by display...(). Do not call if noDisplayer(). More...
|
bool | passFilter (const char *filter) |
| Returns true if the string must be logged, according to the current filter. More...
|
void | displayString (const char *str) |
| Display a string in decorated form to all attached displayers. More...
|
void | displayRawString (const char *str) |
| Display a Raw string to all attached displayers. More...
|
Protected Attributes |
TLogType | _LogType |
sint | _Line |
char * | _FileName |
CDisplayers | _Displayers |
CDisplayers | _BypassFilterDisplayers |
CMutex | _Mutex |
uint32 | _PosSet |
std::list< std::string > | _NegativeFilter |
| "Discard" filter. More...
|
std::list< std::string > | _PositiveFilter |
| "Crop" filter. More...
|
Static Protected Attributes |
std::string | _ProcessName = "" |
Detailed Description
When display() is called, the logger builds a string a sends it to its attached displayers.
The positive filters, if any, are applied first, then the negative filters. See the nldebug/nlinfo... macros in debug.h.
How to log information (for debugging purpose) ? -
Todo:
-
cado: display() and displayRaw() should save the string and send it only when displayRawNL() (or a flush()-style method) is called.
-
Author:
-
Vianney Lecroart, Olivier Cado , Nevrax France
-
Date:
-
2001
Definition at line 53 of file log.h.
Member Typedef Documentation
Member Enumeration Documentation
enum NLMISC::CLog::TLogType
|
|
|
-
Enumeration values:
-
LOG_NO |
|
LOG_ERROR |
|
LOG_WARNING |
|
LOG_INFO |
|
LOG_DEBUG |
|
LOG_STAT |
|
LOG_ASSERT |
|
LOG_UNKNOWN |
|
Definition at line 56 of file log.h. |
Constructor & Destructor Documentation
NLMISC::CLog::CLog |
( |
TLogType |
logType = LOG_NO |
) |
|
|
Member Function Documentation
void NLMISC::CLog::addDisplayer |
( |
IDisplayer * |
displayer, |
|
|
bool |
bypassFilter = false |
|
) |
|
|
|
Add a new displayer in the log. You have to create the displayer, remove it and delete it when you have finish with it. For example, in a 3dDisplayer, you can add the displayer when you want, and the displayer displays the string if the 3d screen is available and do nothing otherwise. In this case, if you want, you could leave the displayer all the time.
Definition at line 98 of file log.cpp.
References _BypassFilterDisplayers, _Displayers, and nlwarning. |
void NLMISC::CLog::addNegativeFilter |
( |
const char * |
filterstr |
) |
|
|
|
Adds a negative filter. Tells the logger to discard the lines that contain filterstr.
Definition at line 581 of file log.cpp.
References _NegativeFilter. |
void NLMISC::CLog::addPositiveFilter |
( |
const char * |
filterstr |
) |
|
|
|
Adds a positive filter. Tells the logger to log only the lines that contain filterstr.
Definition at line 575 of file log.cpp.
References _PositiveFilter. |
bool NLMISC::CLog::attached |
( |
IDisplayer * |
displayer |
) |
const |
|
void NLMISC::CLog::display |
( |
const char * |
format, |
|
|
... |
|
|
) |
|
|
void NLMISC::CLog::displayFilter |
( |
CLog & |
log |
) |
|
|
void NLMISC::CLog::displayNL |
( |
const char * |
format, |
|
|
... |
|
|
) |
|
|
void NLMISC::CLog::displayRaw |
( |
const char * |
format, |
|
|
... |
|
|
) |
|
|
void NLMISC::CLog::displayRawNL |
( |
const char * |
format, |
|
|
... |
|
|
) |
|
|
void NLMISC::CLog::displayRawString |
( |
const char * |
str |
) |
[protected] |
|
|
Display a Raw string to all attached displayers.
Definition at line 369 of file log.cpp.
References _BypassFilterDisplayers, _Displayers, _FileName, _Line, _LogType, _ProcessName, NLMISC::getCallStackAndLog, NLMISC::getThreadId, LOG_ASSERT, LOG_ERROR, passFilter, setDefaultProcessName, NLMISC::TempArgs, NLMISC::TempString, and unsetPosition.
Referenced by displayRaw, and displayRawNL. |
void NLMISC::CLog::displayString |
( |
const char * |
str |
) |
[protected] |
|
|
Display a string in decorated form to all attached displayers.
Definition at line 227 of file log.cpp.
References _BypassFilterDisplayers, _Displayers, _FileName, _Line, _LogType, _ProcessName, NLMISC::getCallStackAndLog, NLMISC::getThreadId, LOG_ASSERT, LOG_ERROR, passFilter, setDefaultProcessName, NLMISC::TempArgs, NLMISC::TempString, and unsetPosition.
Referenced by display, and displayNL. |
void NLMISC::CLog::forceDisplayRaw |
( |
const char * |
format, |
|
|
... |
|
|
) |
|
|
IDisplayer * NLMISC::CLog::getDisplayer |
( |
const char * |
displayerName |
) |
|
|
bool NLMISC::CLog::noDisplayer |
( |
|
) |
const [inline] |
|
bool NLMISC::CLog::passFilter |
( |
const char * |
filter |
) |
[protected] |
|
void NLMISC::CLog::removeDisplayer |
( |
const char * |
displayerName |
) |
|
|
void NLMISC::CLog::removeDisplayer |
( |
IDisplayer * |
displayer |
) |
|
|
void NLMISC::CLog::removeFilter |
( |
const char * |
filterstr = NULL |
) |
|
|
void NLMISC::CLog::resetFilters |
( |
|
) |
|
|
void NLMISC::CLog::setDefaultProcessName |
( |
|
) |
[static] |
|
void NLMISC::CLog::setPosition |
( |
sint |
line, |
|
|
char * |
fileName |
|
) |
|
|
void NLMISC::CLog::setProcessName |
( |
const std::string & |
processName |
) |
[static] |
|
void NLMISC::CLog::unsetPosition |
( |
|
) |
[protected] |
|
Member Data Documentation
CDisplayers NLMISC::CLog::_BypassFilterDisplayers [protected]
|
|
char* NLMISC::CLog::_FileName [protected]
|
|
sint NLMISC::CLog::_Line [protected]
|
|
TLogType NLMISC::CLog::_LogType [protected]
|
|
CMutex NLMISC::CLog::_Mutex [protected]
|
|
std::list<std::string> NLMISC::CLog::_NegativeFilter [protected]
|
|
std::list<std::string> NLMISC::CLog::_PositiveFilter [protected]
|
|
uint32 NLMISC::CLog::_PosSet [protected]
|
|
string NLMISC::CLog::_ProcessName = "" [static, protected]
|
|
The documentation for this class was generated from the following files:
|
|