From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02986.html | 2184 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2184 insertions(+) create mode 100644 docs/doxygen/nel/a02986.html (limited to 'docs/doxygen/nel/a02986.html') diff --git a/docs/doxygen/nel/a02986.html b/docs/doxygen/nel/a02986.html new file mode 100644 index 00000000..5160ace1 --- /dev/null +++ b/docs/doxygen/nel/a02986.html @@ -0,0 +1,2184 @@ + + +NeL: NLNET::CNetLog class Reference + + + +
+

NLNET::CNetLog Class Reference

#include <net_log.h> +

+

Inheritance diagram for NLNET::CNetLog: +

+ +NLMISC::CLog + +

Detailed Description

+Logger for network transfers
Author:
Olivier Cado

+Nevrax France

+
Date:
2000
+ +

+ +

+Definition at line 52 of file net_log.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Types

enum  TLogType {
+  LOG_NO = 0, +LOG_ERROR, +LOG_WARNING, +LOG_INFO, +
+  LOG_DEBUG, +LOG_STAT, +LOG_ASSERT, +LOG_UNKNOWN +
+ }

Public Member Functions

void addDisplayer (IDisplayer *displayer, bool bypassFilter=false)
void addNegativeFilter (const char *filterstr)
 Adds a negative filter. Tells the logger to discard the lines that contain filterstr.

void addPositiveFilter (const char *filterstr)
 Adds a positive filter. Tells the logger to log only the lines that contain filterstr.

bool attached (IDisplayer *displayer) const
 Returns true if the specified displayer is attached to the log object.

 CNetLog ()
 Constructor.

void display (const char *format,...)
 Display a string in decorated form to all attached displayers. Call setPosition() before. Releases the mutex.

void displayFilter (CLog &log)
 Displays the list of filter into a log.

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.

void displayRaw (const char *format,...)
 Display a string (and nothing more) to all attached displayers. Call setPosition() before. Releases the mutex.

void displayRawNL (const char *format,...)
 Display a string with a final new line to all attached displayers. Call setPosition() before. Releases the mutex.

void forceDisplayRaw (const char *format,...)
IDisplayer * getDisplayer (const char *displayerName)
 Return the first displayer selected by his name.

void input (const char *srchost, uint8 msgnum, const char *desthost)
 Log an input transfer (receive).

bool noDisplayer () const
 Returns true if no displayer is attached.

void output (const char *srchost, uint8 msgnum, const char *desthost, const char *msgname, uint32 msgsize)
 Log an output transfer (send).

void removeDisplayer (const char *displayerName)
 Remove a displayer using his name.

void removeDisplayer (IDisplayer *displayer)
 Remove a displayer. If the displayer doesn't work in a specific time, you could remove it.

void removeFilter (const char *filterstr=NULL)
 Removes a filter by name (in both filters).

void resetFilters ()
 Reset both filters.

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.

void setServiceName (const char *name)
 Sets the name of the running service.


Static Public Member Functions

void setDefaultProcessName ()
 Find the process name if nobody call setProcessName before.

void setProcessName (const std::string &processName)
 Set the name of the process.


Protected Types

typedef std::list< IDisplayer * > CDisplayers

Protected Member Functions

void displayRawString (const char *str)
 Display a Raw string to all attached displayers.

void displayString (const char *str)
 Display a string in decorated form to all attached displayers.

bool passFilter (const char *filter)
 Returns true if the string must be logged, according to the current filter.

void unsetPosition ()
 Symetric to setPosition(). Automatically called by display...(). Do not call if noDisplayer().


Protected Attributes

CDisplayers _BypassFilterDisplayers
CDisplayers _Displayers
char * _FileName
sint _Line
TLogType _LogType
CMutex _Mutex
std::list< std::string > _NegativeFilter
 "Discard" filter

std::list< std::string > _PositiveFilter
 "Crop" filter

uint32 _PosSet
TDisplayInfo TempArgs
std::string TempString

Static Protected Attributes

std::string * _ProcessName = NULL

Private Attributes

std::string _ProcessId
+


Member Typedef Documentation

+

+ + + + +
+ + +
typedef std::list<IDisplayer *> NLMISC::CLog::CDisplayers [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 209 of file log.h.

+


Member Enumeration Documentation

+

+ + + + +
+ + +
enum NLMISC::CLog::TLogType [inherited] +
+
+ + + + + +
+   + + +

+

Enumeration values:
+ + + + + + + + + +
LOG_NO  +
LOG_ERROR  +
LOG_WARNING  +
LOG_INFO  +
LOG_DEBUG  +
LOG_STAT  +
LOG_ASSERT  +
LOG_UNKNOWN  +
+
+ +

+Definition at line 57 of file log.h. +

+

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLNET::CNetLog::CNetLog  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 62 of file net_log.cpp. +

+

00062                  :
+00063         CLog()
+00064 {
+00065 }
+
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CLog::addDisplayer IDisplayer displayer,
bool  bypassFilter = false
[inherited]
+
+ + + + + +
+   + + +

+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 115 of file log.cpp. +

+References NLMISC::CLog::_BypassFilterDisplayers, NLMISC::CLog::_Displayers, and nlwarning. +

+Referenced by NLMISC::initDebug2(), NLNET::IService::main(), NLNET::serviceGetView(), and NLNET::updateAdmin(). +

+

00116 {
+00117         if (displayer == NULL)
+00118         {
+00119                 // Can't nlwarning because recursive call
+00120                 printf ("Trying to add a NULL displayer\n");
+00121                 return;
+00122         }
+00123 
+00124         if (bypassFilter)
+00125         {
+00126                 CDisplayers::iterator idi = std::find (_BypassFilterDisplayers.begin (), _BypassFilterDisplayers.end (), displayer);
+00127                 if (idi == _BypassFilterDisplayers.end ())
+00128                 {
+00129                         _BypassFilterDisplayers.push_back (displayer);
+00130                 }
+00131                 else
+00132                 {
+00133                         nlwarning ("LOG: Couldn't add the displayer, it was already added");
+00134                 }
+00135         }
+00136         else
+00137         {
+00138                 CDisplayers::iterator idi = std::find (_Displayers.begin (), _Displayers.end (), displayer);
+00139                 if (idi == _Displayers.end ())
+00140                 {
+00141                         _Displayers.push_back (displayer);
+00142                 }
+00143                 else
+00144                 {
+00145                         nlwarning ("LOG: Couldn't add the displayer, it was already added");
+00146                 }
+00147         }
+00148 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::addNegativeFilter const char *  filterstr  )  [inherited]
+
+ + + + + +
+   + + +

+Adds a negative filter. Tells the logger to discard the lines that contain filterstr. +

+ +

+Definition at line 593 of file log.cpp. +

+References NLMISC::CLog::_NegativeFilter. +

+Referenced by NLNET::cbLogFilter(), and NLMISC::NLMISC_COMMAND(). +

+

00594 {
+00595         //displayNL ("CLog::addNegativeFilter('%s')", filterstr);
+00596         _NegativeFilter.push_back( filterstr );
+00597 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::addPositiveFilter const char *  filterstr  )  [inherited]
+
+ + + + + +
+   + + +

+Adds a positive filter. Tells the logger to log only the lines that contain filterstr. +

+ +

+Definition at line 587 of file log.cpp. +

+References NLMISC::CLog::_PositiveFilter. +

+Referenced by NLMISC::NLMISC_COMMAND(). +

+

00588 {
+00589         //displayNL ("CLog::addPositiveFilter('%s')", filterstr);
+00590         _PositiveFilter.push_back( filterstr );
+00591 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CLog::attached IDisplayer displayer  )  const [inherited]
+
+ + + + + +
+   + + +

+Returns true if the specified displayer is attached to the log object. +

+ +

+Definition at line 235 of file log.cpp. +

+References NLMISC::CLog::_BypassFilterDisplayers, and NLMISC::CLog::_Displayers. +

+

00236 {
+00237         return (find( _Displayers.begin(), _Displayers.end(), displayer ) != _Displayers.end()) ||
+00238                         (find( _BypassFilterDisplayers.begin(), _BypassFilterDisplayers.end(), displayer ) != _BypassFilterDisplayers.end());
+00239 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CLog::display const char *  format,
... 
[inherited]
+
+ + + + + +
+   + + +

+Display a string in decorated form to all attached displayers. Call setPosition() before. Releases the mutex. +

+ +

+Definition at line 348 of file log.cpp. +

+References format, and NLMISC_CONVERT_VARGS. +

+Referenced by NLMISC::CBufFIFO::display(). +

+

00350 {
+00351         if ( noDisplayer() )
+00352         {
+00353                 return;
+00354         }
+00355 
+00356         char *str;
+00357         NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/);
+00358 
+00359         displayString (str);
+00360 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::displayFilter CLog log  )  [inherited]
+
+ + + + + +
+   + + +

+Displays the list of filter into a log. +

+ +

+Definition at line 572 of file log.cpp. +

+References NLMISC::CLog::_NegativeFilter, NLMISC::CLog::_PositiveFilter, and NLMISC::CLog::displayNL(). +

+Referenced by NLMISC::NLMISC_COMMAND(). +

+

00573 {
+00574         std::list<std::string>::iterator it;
+00575         log.displayNL ("Positive Filter(s):");
+00576         for (it = _PositiveFilter.begin (); it != _PositiveFilter.end (); it++)
+00577         {
+00578                 log.displayNL ("'%s'", (*it).c_str());
+00579         }
+00580         log.displayNL ("Negative Filter(s):");
+00581         for (it = _NegativeFilter.begin (); it != _NegativeFilter.end (); it++)
+00582         {
+00583                 log.displayNL ("'%s'", (*it).c_str());
+00584         }
+00585 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CLog::displayNL const char *  format,
... 
[inherited]
+
+ + + + + +
+   + + +

+Display a string in decorated and final new line form to all attached displayers. Call setPosition() before. Releases the mutex. +

+ +

+Definition at line 323 of file log.cpp. +

+References format, and NLMISC_CONVERT_VARGS. +

+Referenced by NLNET::createMessage(), NLNET::CUnifiedNetwork::CUnifiedConnection::display(), NLMISC::CHTimer::display(), NLMISC::displayCallStack(), NLMISC::CLog::displayFilter(), NLMISC::CHTimer::displayHierarchical(), NLNET::CUnifiedNetwork::displayInternalTables(), NLMISC::CBufFIFO::displayStats(), NLMISC::CBitMemStream::displayStream(), NLNET::CBufServer::displayThreadStat(), NLNET::CBufClient::displayThreadStat(), NLMISC::CVariable< std::string >::execute(), NLMISC::IVariable::execute(), NLMISC::ICommand::execute(), NLMISC::ICommand::expand(), NLMISC::CEntityIdTranslator::isValidEntityName(), and NLNET::IService::main(). +

+

00325 {
+00326         if ( noDisplayer() )
+00327         {
+00328                 return;
+00329         }
+00330 
+00331         char *str;
+00332         NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/);
+00333 
+00334         if (strlen(str)<256/*NLMISC::MaxCStringSize*/-1)
+00335                 strcat (str, "\n");
+00336         else
+00337                 str[256/*NLMISC::MaxCStringSize*/-2] = '\n';
+00338 
+00339         displayString (str);
+00340 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CLog::displayRaw const char *  format,
... 
[inherited]
+
+ + + + + +
+   + + +

+Display a string (and nothing more) to all attached displayers. Call setPosition() before. Releases the mutex. +

+ +

+Definition at line 467 of file log.cpp. +

+References format, and NLMISC_CONVERT_VARGS. +

+Referenced by NLNET::cleanRequest(), and NLMISC::CConfigFile::display(). +

+

00469 {
+00470         if ( noDisplayer() )
+00471         {
+00472                 return;
+00473         }
+00474 
+00475         char *str;
+00476         NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/);
+00477 
+00478         displayRawString(str);
+00479 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CLog::displayRawNL const char *  format,
... 
[inherited]
+
+ + + + + +
+   + + +

+Display a string with a final new line to all attached displayers. Call setPosition() before. Releases the mutex. +

+ +

+Definition at line 442 of file log.cpp. +

+References format, and NLMISC_CONVERT_VARGS. +

+Referenced by NLNET::cleanRequest(), NLMISC::CHTimer::CStats::display(), NLMISC::CHTimer::display(), NLMISC::CConfigFile::display(), NLMISC::CHTimer::displayByExecutionPath(), NLMISC::displayByteBits(), NLMISC::displayDwordBits(), NLMISC::CHTimer::displayHierarchical(), NLMISC::CHTimer::displayHierarchicalByExecutionPathSorted(), NLMISC::CHTimer::CNode::displayPath(), NLMISC::CBitMemStream::displayStream(), NLMISC::CHTimer::displaySummary(), input(), and output(). +

+

00444 {
+00445         if ( noDisplayer() )
+00446         {
+00447                 return;
+00448         }
+00449 
+00450         char *str;
+00451         NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/);
+00452 
+00453         if (strlen(str)<256/*NLMISC::MaxCStringSize*/-1)
+00454                 strcat (str, "\n");
+00455         else
+00456                 str[256/*NLMISC::MaxCStringSize*/-2] = '\n';
+00457 
+00458         displayRawString(str);
+00459 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::displayRawString const char *  str  )  [protected, inherited]
+
+ + + + + +
+   + + +

+Display a Raw string to all attached displayers. +

+ +

+Definition at line 362 of file log.cpp. +

+References NLMISC::CLog::_BypassFilterDisplayers, NLMISC::CLog::_Displayers, NLMISC::CLog::TDisplayInfo::CallstackAndLog, NLMISC::CLog::TDisplayInfo::Date, NLMISC::CLog::TDisplayInfo::Filename, NLMISC::getCallStackAndLog(), NLMISC::CLog::TDisplayInfo::Line, NLMISC::CLog::LOG_ASSERT, NLMISC::CLog::LOG_ERROR, NLMISC::CLog::TDisplayInfo::LogType, NLMISC::CLog::passFilter(), NLMISC::CLog::TDisplayInfo::ProcessName, NLMISC::CLog::setDefaultProcessName(), NLMISC::CLog::TempArgs, NLMISC::CLog::TempString, NLMISC::CLog::TDisplayInfo::ThreadId, and NLMISC::CLog::unsetPosition(). +

+

00363 {
+00364         const char *disp = NULL;
+00365         TDisplayInfo localargs, *args = NULL;
+00366 
+00367         setDefaultProcessName ();
+00368 
+00369         if(strchr(str,'\n') == NULL)
+00370         {
+00371                 if (TempString.empty())
+00372                 {
+00373                         localargs.Date = 0;
+00374                         localargs.LogType = CLog::LOG_NO;
+00375                         localargs.ProcessName = "";
+00376                         localargs.ThreadId = 0;
+00377                         localargs.Filename = NULL;
+00378                         localargs.Line = -1;
+00379                         localargs.CallstackAndLog = "";
+00380 
+00381                         TempString = str;
+00382                 }
+00383                 else
+00384                 {
+00385                         TempString += str;
+00386                 }
+00387                 return;
+00388         }
+00389         else
+00390         {
+00391                 if (TempString.empty())
+00392                 {
+00393                         localargs.Date = 0;
+00394                         localargs.LogType = CLog::LOG_NO;
+00395                         localargs.ProcessName = "";
+00396                         localargs.ThreadId = 0;
+00397                         localargs.Filename = NULL;
+00398                         localargs.Line = -1;
+00399                         localargs.CallstackAndLog = "";
+00400 
+00401                         disp = str;
+00402                         args = &localargs;
+00403                 }
+00404                 else
+00405                 {
+00406                         TempString += str;
+00407                         disp = TempString.c_str();
+00408                         args = &TempArgs;
+00409                 }
+00410         }
+00411 
+00412         // send to all bypass filter displayers
+00413         for (CDisplayers::iterator idi=_BypassFilterDisplayers.begin(); idi!=_BypassFilterDisplayers.end(); idi++ )
+00414         {
+00415                 (*idi)->display( *args, disp );
+00416         }
+00417 
+00418         // get the log at the last minute to be sure to have everything
+00419         if(args->LogType == LOG_ERROR || args->LogType == LOG_ASSERT)
+00420         {
+00421                 getCallStackAndLog (args->CallstackAndLog, 4);
+00422         }
+00423 
+00424         if ( passFilter( disp ) )
+00425         {
+00426                 // Send to the attached displayers
+00427                 for ( CDisplayers::iterator idi=_Displayers.begin(); idi!=_Displayers.end(); idi++ )
+00428                 {
+00429                         (*idi)->display( *args, disp );
+00430                 }
+00431         }
+00432         TempString = "";
+00433         unsetPosition();
+00434 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::displayString const char *  str  )  [protected, inherited]
+
+ + + + + +
+   + + +

+Display a string in decorated form to all attached displayers. +

+ +

+Definition at line 242 of file log.cpp. +

+References NLMISC::CLog::_BypassFilterDisplayers, NLMISC::CLog::_Displayers, NLMISC::CLog::_LogType, NLMISC::CLog::_ProcessName, NLMISC::CLog::TDisplayInfo::CallstackAndLog, NLMISC::CLog::TDisplayInfo::Date, NLMISC::CLog::TDisplayInfo::Filename, NLMISC::getCallStackAndLog(), NLMISC::getThreadId(), NLMISC::CLog::TDisplayInfo::Line, NLMISC::CLog::LOG_ASSERT, NLMISC::CLog::LOG_ERROR, NLMISC::CLog::TDisplayInfo::LogType, NLMISC::CLog::passFilter(), NLMISC::CLog::TDisplayInfo::ProcessName, NLMISC::CLog::setDefaultProcessName(), NLMISC::CLog::TempArgs, NLMISC::CLog::TempString, NLMISC::CLog::TDisplayInfo::ThreadId, and NLMISC::CLog::unsetPosition(). +

+

00243 {
+00244         const char *disp = NULL;
+00245         TDisplayInfo localargs, *args = NULL;
+00246 
+00247         setDefaultProcessName ();
+00248 
+00249         if(strchr(str,'\n') == NULL)
+00250         {
+00251                 if (TempString.empty())
+00252                 {
+00253                         time (&TempArgs.Date);
+00254                         TempArgs.LogType = _LogType;
+00255                         TempArgs.ProcessName = *_ProcessName;
+00256                         TempArgs.ThreadId = getThreadId();
+00257                         TempArgs.Filename = _FileName;
+00258                         TempArgs.Line = _Line;
+00259                         TempArgs.CallstackAndLog = "";
+00260 
+00261                         TempString = str;
+00262                 }
+00263                 else
+00264                 {
+00265                         TempString += str;
+00266                 }
+00267                 return;
+00268         }
+00269         else
+00270         {
+00271                 if (TempString.empty())
+00272                 {
+00273                         time (&localargs.Date);
+00274                         localargs.LogType = _LogType;
+00275                         localargs.ProcessName = *_ProcessName;
+00276                         localargs.ThreadId = getThreadId();
+00277                         localargs.Filename = _FileName;
+00278                         localargs.Line = _Line;
+00279                         localargs.CallstackAndLog = "";
+00280 
+00281                         disp = str;
+00282                         args = &localargs;
+00283                 }
+00284                 else
+00285                 {
+00286                         TempString += str;
+00287                         disp = TempString.c_str();
+00288                         args = &TempArgs;
+00289                 }
+00290         }
+00291 
+00292         // send to all bypass filter displayers
+00293         for (CDisplayers::iterator idi=_BypassFilterDisplayers.begin(); idi!=_BypassFilterDisplayers.end(); idi++ )
+00294         {
+00295                 (*idi)->display( *args, disp );
+00296         }
+00297 
+00298         // get the log at the last minute to be sure to have everything
+00299         if(args->LogType == LOG_ERROR || args->LogType == LOG_ASSERT)
+00300         {
+00301                 getCallStackAndLog (args->CallstackAndLog, 4);
+00302         }
+00303 
+00304         if (passFilter (disp))
+00305         {
+00306                 // Send to the attached displayers
+00307                 for (CDisplayers::iterator idi=_Displayers.begin(); idi!=_Displayers.end(); idi++ )
+00308                 {
+00309                         (*idi)->display( *args, disp );
+00310                 }
+00311         }
+00312         TempString = "";
+00313         unsetPosition();
+00314 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CLog::forceDisplayRaw const char *  format,
... 
[inherited]
+
+ + + + + +
+   + + +

+Display a raw text to the normal displayer but without filtering It's used by the Memdisplayer (little hack to work) +

+Definition at line 485 of file log.cpp. +

+References format, and NLMISC_CONVERT_VARGS. +

+Referenced by NLMISC::CMemDisplayer::write(). +

+

00487 {
+00488         if ( noDisplayer() )
+00489         {
+00490                 return;
+00491         }
+00492 
+00493         char *str;
+00494         NLMISC_CONVERT_VARGS (str, format, 256/*NLMISC::MaxCStringSize*/);
+00495 
+00496         TDisplayInfo args;
+00497         CDisplayers::iterator idi;
+00498 
+00499         // send to all bypass filter displayers
+00500         for (idi=_BypassFilterDisplayers.begin(); idi!=_BypassFilterDisplayers.end(); idi++ )
+00501         {
+00502                 (*idi)->display( args, str );
+00503         }
+00504 
+00505         // Send to the attached displayers
+00506         for ( idi=_Displayers.begin(); idi!=_Displayers.end(); idi++ )
+00507         {
+00508                 (*idi)->display( args, str );
+00509         }
+00510 }
+
+

+ + + + +
+ + + + + + + + + + +
IDisplayer * NLMISC::CLog::getDisplayer const char *  displayerName  )  [inherited]
+
+ + + + + +
+   + + +

+Return the first displayer selected by his name. +

+ +

+Definition at line 206 of file log.cpp. +

+References NLMISC::CLog::_BypassFilterDisplayers, NLMISC::CLog::_Displayers, and nlwarning. +

+

00207 {
+00208         if (displayerName == NULL || displayerName[0] == '\0')
+00209         {
+00210                 nlwarning ("LOG: Trying to get an empty displayer name");
+00211                 return NULL;
+00212         }
+00213 
+00214         CDisplayers::iterator idi;
+00215         for (idi = _Displayers.begin (); idi != _Displayers.end (); idi++)
+00216         {
+00217                 if ((*idi)->DisplayerName == displayerName)
+00218                 {
+00219                         return *idi;
+00220                 }
+00221         }
+00222         for (idi = _BypassFilterDisplayers.begin (); idi != _BypassFilterDisplayers.end (); idi++)
+00223         {
+00224                 if ((*idi)->DisplayerName == displayerName)
+00225                 {
+00226                         return *idi;
+00227                 }
+00228         }
+00229         return NULL;
+00230 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
void NLNET::CNetLog::input const char *  srchost,
uint8  msgnum,
const char *  desthost
+
+ + + + + +
+   + + +

+Log an input transfer (receive). +

+ +

+Definition at line 91 of file net_log.cpp. +

+References NLMISC::CLog::displayRawNL(), and uint8. +

+

00092 {
+00093 /*OLD   char line [1024];
+00094         smprintf( line, 1024, "##%"NL_I64"d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
+00095                           srchost, msgnum, _ProcessName.c_str(), desthost );
+00096         displayRawNL( line );
+00097 */
+00098 /*      displayRawNL( "##%"NL_I64"d#%s#%hu#%s#%s#", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
+00099                   srchost, msgnum, _ProcessName.c_str(), desthost );
+00100 */
+00101         displayRawNL( "##0#%s#%hu#%s#%s#", 
+00102                   srchost, msgnum, (*_ProcessName).c_str(), desthost );
+00103 }
+
+

+ + + + +
+ + + + + + + + + +
bool NLMISC::CLog::noDisplayer  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+Returns true if no displayer is attached. +

+ +

+Definition at line 95 of file log.h. +

+References NLMISC::CLog::_BypassFilterDisplayers, and NLMISC::CLog::_Displayers. +

+Referenced by NLMISC::CLog::setPosition(), and NLMISC::CLog::unsetPosition(). +

+

00095 { return _Displayers.empty() && _BypassFilterDisplayers.empty(); }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLNET::CNetLog::output const char *  srchost,
uint8  msgnum,
const char *  desthost,
const char *  msgname,
uint32  msgsize
+
+ + + + + +
+   + + +

+Log an output transfer (send). +

+ +

+Definition at line 71 of file net_log.cpp. +

+References NLMISC::CLog::displayRawNL(), uint16, uint32, and uint8. +

+

00073 {
+00074 /*OLD   char line [1024];
+00075         smprintf( line, 1024, "@@%"NL_I64"d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
+00076                 srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize );
+00077 
+00078         displayRawNL( line );
+00079         */
+00080 /*      displayRawNL( "@@%"NL_I64"d@%s@%hu@%s@%s@%s@%u@", (CUniTime::Sync?CUniTime::getUniTime():(TTime)0),
+00081                 srchost, (uint16)msgnum, _ProcessName.c_str(), desthost, msgname, msgsize );
+00082 */
+00083         displayRawNL( "@@0@%s@%hu@%s@%s@%s@%u@",
+00084                 srchost, (uint16)msgnum, (*_ProcessName).c_str(), desthost, msgname, msgsize );
+00085 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CLog::passFilter const char *  filter  )  [protected, inherited]
+
+ + + + + +
+   + + +

+Returns true if the string must be logged, according to the current filter. +

+ +

+Definition at line 517 of file log.cpp. +

+References NLMISC::CLog::_NegativeFilter, and NLMISC::CLog::_PositiveFilter. +

+Referenced by NLMISC::CLog::displayRawString(), and NLMISC::CLog::displayString(). +

+

00518 {
+00519         bool yes = _PositiveFilter.empty();
+00520 
+00521         bool found;
+00522         list<string>::iterator ilf;
+00523 
+00524         // 1. Positive filter
+00525         for ( ilf=_PositiveFilter.begin(); ilf!=_PositiveFilter.end(); ++ilf )
+00526         {
+00527                 found = ( strstr( filter, (*ilf).c_str() ) != NULL );
+00528                 if ( found )
+00529                 {
+00530                         yes = true; // positive filter passed (no need to check another one)
+00531                         break;
+00532                 }
+00533                 // else try the next one
+00534         }
+00535         if ( ! yes )
+00536         {
+00537                 return false; // positive filter not passed
+00538         }
+00539 
+00540         // 2. Negative filter
+00541         for ( ilf=_NegativeFilter.begin(); ilf!=_NegativeFilter.end(); ++ilf )
+00542         {
+00543                 found = ( strstr( filter, (*ilf).c_str() ) != NULL );
+00544                 if ( found )
+00545                 {
+00546                         return false; // negative filter not passed (no need to check another one)
+00547                 }
+00548         }
+00549         return true; // negative filter passed
+00550 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::removeDisplayer const char *  displayerName  )  [inherited]
+
+ + + + + +
+   + + +

+Remove a displayer using his name. +

+ +

+Definition at line 172 of file log.cpp. +

+References NLMISC::CLog::_BypassFilterDisplayers, NLMISC::CLog::_Displayers, and nlwarning. +

+

00173 {
+00174         if (displayerName == NULL || displayerName[0] == '\0')
+00175         {
+00176                 nlwarning ("LOG: Trying to remove an empty displayer name");
+00177                 return;
+00178         }
+00179 
+00180         CDisplayers::iterator idi;
+00181         for (idi = _Displayers.begin (); idi != _Displayers.end ();)
+00182         {
+00183                 if ((*idi)->DisplayerName == displayerName)
+00184                 {
+00185                         idi = _Displayers.erase (idi);
+00186                 }
+00187                 else
+00188                 {
+00189                         idi++;
+00190                 }
+00191         }
+00192 
+00193         for (idi = _BypassFilterDisplayers.begin (); idi != _BypassFilterDisplayers.end ();)
+00194         {
+00195                 if ((*idi)->DisplayerName == displayerName)
+00196                 {
+00197                         idi = _BypassFilterDisplayers.erase (idi);
+00198                 }
+00199                 else
+00200                 {
+00201                         idi++;
+00202                 }
+00203         }
+00204 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::removeDisplayer IDisplayer displayer  )  [inherited]
+
+ + + + + +
+   + + +

+Remove a displayer. If the displayer doesn't work in a specific time, you could remove it. +

+ +

+Definition at line 150 of file log.cpp. +

+References NLMISC::CLog::_BypassFilterDisplayers, NLMISC::CLog::_Displayers, and nlwarning. +

+Referenced by NLNET::IService::main(). +

+

00151 {
+00152         if (displayer == NULL)
+00153         {
+00154                 nlwarning ("LOG: Trying to remove a NULL displayer");
+00155                 return;
+00156         }
+00157 
+00158         CDisplayers::iterator idi = std::find (_Displayers.begin (), _Displayers.end (), displayer);
+00159         if (idi != _Displayers.end ())
+00160         {
+00161                 _Displayers.erase (idi);
+00162         }
+00163 
+00164         idi = std::find (_BypassFilterDisplayers.begin (), _BypassFilterDisplayers.end (), displayer);
+00165         if (idi != _BypassFilterDisplayers.end ())
+00166         {
+00167                 _BypassFilterDisplayers.erase (idi);
+00168         }
+00169 
+00170 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::removeFilter const char *  filterstr = NULL  )  [inherited]
+
+ + + + + +
+   + + +

+Removes a filter by name (in both filters). +

+ +

+Definition at line 556 of file log.cpp. +

+References NLMISC::CLog::_NegativeFilter, and NLMISC::CLog::_PositiveFilter. +

+Referenced by NLNET::cbLogFilter(), and NLMISC::NLMISC_COMMAND(). +

+

00557 {
+00558         if (filterstr == NULL)
+00559         {
+00560                 _PositiveFilter.clear();
+00561                 _NegativeFilter.clear();
+00562                 //displayNL ("CLog::addNegativeFilter('%s')", filterstr);
+00563         }
+00564         else
+00565         {
+00566                 _PositiveFilter.remove( filterstr );
+00567                 _NegativeFilter.remove( filterstr );
+00568                 //displayNL ("CLog::removeFilter('%s')", filterstr);
+00569         }
+00570 }
+
+

+ + + + +
+ + + + + + + + + +
void NLMISC::CLog::resetFilters  )  [inherited]
+
+ + + + + +
+   + + +

+Reset both filters. +

+ +

+Definition at line 599 of file log.cpp. +

+References NLMISC::CLog::_NegativeFilter, and NLMISC::CLog::_PositiveFilter. +

+Referenced by NLMISC::NLMISC_COMMAND(). +

+

00600 {
+00601         //displayNL ("CLog::resetFilter()");
+00602         _PositiveFilter.clear();
+00603         _NegativeFilter.clear();
+00604 }
+
+

+ + + + +
+ + + + + + + + + +
void NLMISC::CLog::setDefaultProcessName  )  [static, inherited]
+
+ + + + + +
+   + + +

+Find the process name if nobody call setProcessName before. +

+ +

+Definition at line 55 of file log.cpp. +

+References NLMISC::CLog::_ProcessName. +

+Referenced by NLMISC::CLog::displayRawString(), and NLMISC::CLog::displayString(). +

+

00056 {
+00057         if (_ProcessName == NULL)
+00058         {
+00059 #undef new
+00060                 _ProcessName = new string;
+00061 #define new NL_NEW
+00062         }
+00063 
+00064 #ifdef NL_OS_WINDOWS
+00065         if ((*_ProcessName).empty())
+00066         {
+00067                 char name[1024];
+00068                 GetModuleFileName (NULL, name, 1023);
+00069                 (*_ProcessName) = CFile::getFilename(name);
+00070         }
+00071 #else
+00072         if ((*_ProcessName).empty())
+00073         {
+00074                 *_ProcessName = "<Unknown>";
+00075         }
+00076 #endif
+00077 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CLog::setPosition sint  line,
char *  fileName
[inherited]
+
+ + + + + +
+   + + +

+If !noDisplayer(), sets line and file parameters, and enters the mutex. If !noDisplayer(), don't forget to call display...() after, to release the mutex. +

+ +

+Definition at line 89 of file log.cpp. +

+References NLMISC::CLog::_PosSet, NLMISC::CLog::noDisplayer(), and sint. +

+

00090 {
+00091         if ( !noDisplayer() )
+00092         {
+00093                 _Mutex.enter();
+00094                 _PosSet++;
+00095             _Line = line;
+00096                 _FileName = filename;
+00097         }
+00098 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CLog::setProcessName const std::string &  processName  )  [static, inherited]
+
+ + + + + +
+   + + +

+Set the name of the process. +

+ +

+Definition at line 79 of file log.cpp. +

+References NLMISC::CLog::_ProcessName. +

+Referenced by NLNET::IService::main(). +

+

00080 {
+00081         if (_ProcessName == NULL)
+00082         {
+00083                 _ProcessName = new string;
+00084         }
+00085 
+00086         *_ProcessName = processName;
+00087 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLNET::CNetLog::setServiceName const char *  name  ) 
+
+ + + + + +
+   + + +

+Sets the name of the running service. +

+

+

+ + + + +
+ + + + + + + + + +
void NLMISC::CLog::unsetPosition  )  [protected, inherited]
+
+ + + + + +
+   + + +

+Symetric to setPosition(). Automatically called by display...(). Do not call if noDisplayer(). +

+ +

+Definition at line 101 of file log.cpp. +

+References NLMISC::CLog::_PosSet, nlassert, and NLMISC::CLog::noDisplayer(). +

+Referenced by NLMISC::CLog::displayRawString(), and NLMISC::CLog::displayString(). +

+

00102 {
+00103         nlassert( !noDisplayer() );
+00104 
+00105         if ( _PosSet > 0 )
+00106         {
+00107                 _FileName = NULL;
+00108                 _Line = -1;
+00109                 _PosSet--;
+00110                 _Mutex.leave(); // needs setPosition() to have been called
+00111         }
+00112 }
+
+


Field Documentation

+

+ + + + +
+ + +
CDisplayers NLMISC::CLog::_BypassFilterDisplayers [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 213 of file log.h. +

+Referenced by NLMISC::CLog::addDisplayer(), NLMISC::CLog::attached(), NLMISC::CLog::displayRawString(), NLMISC::CLog::displayString(), NLMISC::CLog::getDisplayer(), NLMISC::CLog::noDisplayer(), and NLMISC::CLog::removeDisplayer().

+

+ + + + +
+ + +
CDisplayers NLMISC::CLog::_Displayers [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 211 of file log.h. +

+Referenced by NLMISC::CLog::addDisplayer(), NLMISC::CLog::attached(), NLMISC::CLog::displayRawString(), NLMISC::CLog::displayString(), NLMISC::CLog::getDisplayer(), NLMISC::CLog::noDisplayer(), and NLMISC::CLog::removeDisplayer().

+

+ + + + +
+ + +
char* NLMISC::CLog::_FileName [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 207 of file log.h.

+

+ + + + +
+ + +
sint NLMISC::CLog::_Line [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 206 of file log.h.

+

+ + + + +
+ + +
TLogType NLMISC::CLog::_LogType [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 203 of file log.h. +

+Referenced by NLMISC::CLog::displayString().

+

+ + + + +
+ + +
CMutex NLMISC::CLog::_Mutex [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 215 of file log.h.

+

+ + + + +
+ + +
std::list<std::string> NLMISC::CLog::_NegativeFilter [protected, inherited] +
+
+ + + + + +
+   + + +

+"Discard" filter +

+ +

+Definition at line 220 of file log.h. +

+Referenced by NLMISC::CLog::addNegativeFilter(), NLMISC::CLog::displayFilter(), NLMISC::CLog::passFilter(), NLMISC::CLog::removeFilter(), and NLMISC::CLog::resetFilters().

+

+ + + + +
+ + +
std::list<std::string> NLMISC::CLog::_PositiveFilter [protected, inherited] +
+
+ + + + + +
+   + + +

+"Crop" filter +

+ +

+Definition at line 223 of file log.h. +

+Referenced by NLMISC::CLog::addPositiveFilter(), NLMISC::CLog::displayFilter(), NLMISC::CLog::passFilter(), NLMISC::CLog::removeFilter(), and NLMISC::CLog::resetFilters().

+

+ + + + +
+ + +
uint32 NLMISC::CLog::_PosSet [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 217 of file log.h. +

+Referenced by NLMISC::CLog::setPosition(), and NLMISC::CLog::unsetPosition().

+

+ + + + +
+ + +
std::string NLNET::CNetLog::_ProcessId [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 77 of file net_log.h.

+

+ + + + +
+ + +
string * NLMISC::CLog::_ProcessName = NULL [static, protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 49 of file log.cpp. +

+Referenced by NLMISC::CLog::displayString(), NLMISC::CLog::setDefaultProcessName(), and NLMISC::CLog::setProcessName().

+

+ + + + +
+ + +
TDisplayInfo NLMISC::CLog::TempArgs [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 232 of file log.h. +

+Referenced by NLMISC::CLog::displayRawString(), and NLMISC::CLog::displayString().

+

+ + + + +
+ + +
std::string NLMISC::CLog::TempString [protected, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 231 of file log.h. +

+Referenced by NLMISC::CLog::displayRawString(), and NLMISC::CLog::displayString().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 14:01:24 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1