diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.4&content-type=text/x-cvsweb-markup&sortby=date | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.4&content-type=text/x-cvsweb-markup&sortby=date/index.html | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.4&content-type=text/x-cvsweb-markup&sortby=date/index.html b/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.4&content-type=text/x-cvsweb-markup&sortby=date/index.html new file mode 100644 index 00000000..b75d0e77 --- /dev/null +++ b/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?rev=1.4&content-type=text/x-cvsweb-markup&sortby=date/index.html @@ -0,0 +1,87 @@ +<!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.4</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=date"><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=date">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=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/doc/?sortby=date">doc</a></b></td></tr></table><HR noshade><table width="100%"><tr><td bgcolor="#ffffff">File: <a href="/cvs/cvsweb.cgi/?sortby=date">Nevrax</a> / <a href="/cvs/cvsweb.cgi/code/?sortby=date">code</a> / <a href="/cvs/cvsweb.cgi/code/nel/?sortby=date">nel</a> / <a href="/cvs/cvsweb.cgi/code/nel/doc/?sortby=date">doc</a> / <a href="/cvs/cvsweb.cgi/code/nel/doc/logging.dxt?sortby=date">logging.dxt</a> (<A HREF="/cvs/cvsweb.cgi/~checkout~/code/nel/doc/logging.dxt?rev=1.4&sortby=date" target="cvs_checkout" onClick="window.open('/cvs/cvsweb.cgi/~checkout~/code/nel/doc/logging.dxt?rev=1.4','cvs_checkout','resizeable,scrollbars');"><b>download</b></A>)<BR> +Revision <B>1.4</B>, <i>Mon Feb 5 16:11:36 2001 UTC</i> (17 months, 3 weeks ago) by <i>lecroart</i> +<BR>Branch: <b>MAIN</b> +<BR>CVS Tags: <b>proto_0_2, nel_0_3</b><BR>Changes since <b>1.3: +1 -1 + lines</b><PRE> +new display system +</PRE> +</td></tr></table><HR noshade><PRE>/** + \page log_howto How to log information ? + \author Olivier Cado + + 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. + You need to include the following header files : "nel/misc/debug.h" "nel/misc/log.h". + + \subsection init_log Initialization + + In the initialization of your service (see NLNET::IService), attach some displayers to the global NLMISC::CLog objects + \e ErrorLog, \e WarningLog, \e InfoLog, \e DebugLog and \e AssertLog. + NLMISC::CStdDisplayer is for the screen (and VC++ debug 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 server documentation) + + If your program is not a service (i.e. it is not inherited from NLNET::IService), + don't forget to call \b NLMISC::InitDebug() at the beginning of your program, otherwise + the logging functions won't work. + + Example : + \code + + NLMISC::InitDebug(); // if your program does not inherit from NLNET::IService + 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 ); + } + \endcode + + \subsection use_log Logging information + In your code, use the macros : \e nlerror, \e nlwarning, \e nlinfo, \e nldebug with a variable number of arguments. + You have to include the header "nel/misc/debug.h". + + Example : + \code + nldebug( "Toto is %d years old", age ); + if ( age < 0 ) + { + nlerror( "Invalid age for toto : %d", age ); + // the program counter will never be here because nlerror throw an exception to exit + } + \endcode + + - How to log a string without repeating the header ? + + The macros nldebug() and nlerror() call some methods of NLMISC::CLog, including displayNL(). + It prints a string with an information header. + If you don't want to print the header, use the others methods of NLMISC::CLog. + + Example : + \code + 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 ); + } + \endcode + + \subsection network_transfers Analysing network transfers + + NLNET::NetLog (declared in "nel/net/nel_log.h") 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 |