aboutsummaryrefslogtreecommitdiff
path: root/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.6&content-type=text/x-cvsweb-markup&sortby=author/index.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.6&content-type=text/x-cvsweb-markup&sortby=author/index.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.6&content-type=text/x-cvsweb-markup&sortby=author/index.html')
-rw-r--r--cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.6&content-type=text/x-cvsweb-markup&sortby=author/index.html102
1 files changed, 102 insertions, 0 deletions
diff --git a/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.6&content-type=text/x-cvsweb-markup&sortby=author/index.html b/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.6&content-type=text/x-cvsweb-markup&sortby=author/index.html
new file mode 100644
index 00000000..6f6065b7
--- /dev/null
+++ b/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.6&content-type=text/x-cvsweb-markup&sortby=author/index.html
@@ -0,0 +1,102 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
+<HEAD><style> A { color:black }</style>
+<!-- hennerik CVSweb $Revision: 1.93 $ -->
+<TITLE>code/nel/doc/logging.dxt - view - 1.6</TITLE></HEAD>
+<BODY BGCOLOR="#eeeeee">
+<table width="100%" border=0 cellspacing=0 cellpadding=1 bgcolor="#aaaaaa"><tr valign=bottom><td><a href="logging.dxt?sortby=author"><IMG SRC="http://www.nevrax.org/inc/img/picto-up.gif" ALT="[BACK]" BORDER="0" WIDTH="14" HEIGHT="13"></a> <b>Return to <A HREF="logging.dxt?sortby=author">logging.dxt</A>
+ CVS log</b> <IMG SRC="http://www.nevrax.org/inc/img/picto-news.gif" ALT="[TXT]" BORDER="0" WIDTH="13" HEIGHT="15"></td><td align=right><IMG SRC="http://www.nevrax.org/inc/img/picto-dir.gif" ALT="[DIR]" BORDER="0" WIDTH="15" HEIGHT="13"> <b>Up to <a href="/cvs/cvsweb.cgi/?sortby=author">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=author">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=author">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/doc/?sortby=author">doc</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cvs/cvsweb.cgi/?sortby=author">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=author">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=author">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/doc/?sortby=author">doc</a> / <a href="/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?sortby=author">logging.dxt</a>&nbsp;(<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/doc/logging.dxt?rev=1.6&amp;sortby=author" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/doc/logging.dxt?rev=1.6','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR>
+Revision <B>1.6</B>, <i>Fri May 4 12:38:38 2001 UTC</i> (14 months, 1 week ago) by <i>cado</i>
+<BR>Branch: <b>MAIN</b>
+<BR>CVS Tags: <b>nel_0_4, georges_v2, demo_0_1, HEAD</b><BR>Changes since <b>1.5: +1 -1
+ lines</b><PRE>
+#date fix
+</PRE>
+</td></tr></table><HR noshade><PRE>/**
+ \page log_howto How to log information (for debugging purpose) ?
+ \author Olivier Cado
+ \date Updated May 4 2001
+
+This document explains how to log some information (into the screen, into a file or to a logging server), e.g. in order to debug your code.
+
+\section basic_debug Basic usage of the debugging system
+The debugging sytem allows to log information at various levels. Include the header file &quot;nel/misc/debug.h&quot;.
+
+The main functionalities are offered by the macros nldebug, nlinfo, nlwarning and also nlerror and nlassert, and by their variant forms (see debug.h). They allow to display strings, with open arguments, using the &quot;printf&quot; syntax. In the default behaviour, the text passed to nldebug is displayed into stdout in NL_DEBUG mode, but not in NL_RELEASE. The logged texts are also written into a file called &quot;log.log&quot; in the working directory. These macros print the strings with an information header.
+
+ Example :
+ \code
+ sint32 age = -2;
+ nldebug( &quot;Toto is %d years old&quot;, age );
+ if ( age &lt; 0 )
+ {
+ &nbsp; &nbsp; nlerror( &quot;Invalid age for toto : %d&quot;, age );
+
+ &nbsp; &nbsp; // the program will not come here because nlerror throws an exception to exit
+ }
+
+ STDOUT (logger thread_id file line: debug_string):
+ DBG 1234 myfile.cpp 10: Toto is -2 years old
+ ERR 1234 myfile.cpp 13: Invalid age for toto : -2
+ Abort
+
+ FILE OUTPUT (date time logger debug_string):
+ 01/04/11 18:24:50 DBG: Toto is -2 years old
+ 01/04/11 18:24:50 ERR: Invalid age for toto : -2
+ \endcode
+
+Because NeL allows to create multithreaded programs, these macros use mutual exclusions (mutex) to ensure no data is corrupted and the displayed text not interlaced.
+
+\section adv_log Advanced usage of the logging system
+
+You may want to customize the logging system directly, for your own needs. Include &quot;nel/misc/log.h&quot;.
+
+\subsection init_log Initialization
+If your program is not a &quot;service&quot; in the NeL terms (i.e. if it is not built on NLNET::IService),
+first call createDebug() to create the basic global loggers \e ErrorLog, \e WarningLog, \e InfoLog, \e DebugLog and \e 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).
+- NLMISC::CStdDisplayer is for stdout (the console, the VC++ output window...). It is attached by default to all of the five logger objects mentionned above.
+- NLMISC::CFileDisplayer is for a file.
+- NLMISC::CMsgBoxDisplayer is for a message box.
+- NLNET::CNetDisplayer is for a logging server (see CLogService in the nelns documentation).
+- You can can create your own displayer, in order to print the logged text onto a new target (for example, see the class CChatDisplayer in Snowballs 0.2) or to customize the filter on the header.
+
+Example (we assume CNetDisplayer allows to log via the network):
+ \code
+
+ createDebug(); // automatically done in a &quot;service&quot;
+ NLNET::CNetDisplayer *nd = new CNetDisplayer(); // the address of the Logging Server is automatically retrieved using the Naming Service
+ if ( nd-&gt;connected() ) // this line is optional: here we don't want the displayer to attempt other connections if the first one failed
+ {
+ &nbsp; &nbsp; NLMISC::DebugLog.addDisplayer( nd );
+ }
+ \endcode
+
+ \subsection use_log Logging information
+
+ How to log a string without repeating the header ? Use the methods of NLMISC::CLog.
+
+ Example :
+ \code
+ NLMISC::DebugLog.displayNL ( &quot;Dump of Values :&quot; );
+ for ( int j=0; j!=height; ++j )
+ {
+ &nbsp; &nbsp; for ( int i=0; i!=width; ++i )
+ &nbsp; &nbsp; {
+ &nbsp; &nbsp; &nbsp; &nbsp; NLMISC::DebugLog.displayRaw( &quot;%d &quot;, Values[j][i] );
+ &nbsp; &nbsp; }
+ &nbsp; &nbsp; NLMISC::DebugLog.displayRawNL( &quot;: line %d&quot;, j );
+ }
+ \endcode
+
+*/
+
+ \subsection network_transfers Analysing network transfers
+
+ NLNET::NetLog (declared in &quot;nel/net/nel_log.h&quot;) is a special logger that allows to send output and input logs to a logging server.
+ These logs are produced by the network subsystem and have a special syntax so that an analyser can process them and display the transfers
+ graphically in real-time.
+
+ By default, all services (see NLNET::IService) send this kind of logs if they find a logging server.
+
+</PRE> \ No newline at end of file