You may want to customize the logging system directly for your own needs - include "nel/misc/log.h".
If your program is not a "service" in the NeL terms (i.e. if it is not built on NLNET::IService),
first call createDebug() to create the basic global loggers ErrorLog, WarningLog, InfoLog, DebugLog and AssertLog (the ones that are used by the nlerror, nlwarning, nlinfo, nldebug and nlassert macros).
Then, you can attach some displayers to the global loggers (NLMISC::CLog objects).
Example (we assume CNetDisplayer allows to log via the network):
createDebug(); // automatically done in a "service"
NLNET::CNetDisplayer *nd = new CNetDisplayer(); // the address of the Logging Server is automatically retrieved using the Naming Service
if ( nd->connected() ) // this line is optional: here we don't want the displayer to attempt other connections if the first one failed
{
NLMISC::DebugLog.addDisplayer( nd );
}
How do you log a string without repeating the header? You can use the methods on NLMISC::CLog.
Example:
NLMISC::DebugLog.displayNL ( "Dump of Values :" );
for ( int j=0; j!=height; ++j )
{
for ( int i=0; i!=width; ++i )
{
NLMISC::DebugLog.displayRaw( "%d ", Values[j][i] );
}
NLMISC::DebugLog.displayRawNL( ": line %d", j );
}