[Logging-commits] r37 - www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Apr 12 13:19:54 CEST 2010


Author: mariotomo
Date: 2010-04-12 13:19:53 +0200 (Mon, 12 Apr 2010)
New Revision: 37

Modified:
   www/formatting_your_log_records.shtml
   www/the_basics.shtml
Log:
online documentation edit


Modified: www/formatting_your_log_records.shtml
===================================================================
--- www/formatting_your_log_records.shtml	2010-04-12 09:18:48 UTC (rev 36)
+++ www/formatting_your_log_records.shtml	2010-04-12 11:19:53 UTC (rev 37)
@@ -24,15 +24,18 @@
 
 <p>notice that the field <tt>$msg</tt> of a record is already
 "formatted", as we have seen with <tt>logwarn('my %s is %d', 'name',
-5)</tt>.  that part can be used but not undone any more.  the
-formatter you can associate to a handler can combine the tags in the
-logrecord to produce a string.</p>
+5)</tt>.  that part can be used but not undone any more.  </p>
 
 <p>when you add a handler to a logger, you can use
 the <tt>formatter</tt> parameter to associate to the handler a
 function that takes a logrecord and returns a string.  the above
 example function is such a function.  </p>
 
+<p>the formatter you can associate to a handler can combine the tags
+in the logrecord to produce a string.  the tags that are available in
+a logrecord are: <tt>$logger</tt> (the name of the logger which
+produced the record), <tt>$msg</tt>, <tt>$timestamp</tt>, <tt>$level</tt>
+(numeric), <tt>$levelname</tt> (character).</p>
 
 <p>if you don't specify the <tt>formatter</tt> parameter, the default
 formatter is used, which looks like this:</p>

Modified: www/the_basics.shtml
===================================================================
--- www/the_basics.shtml	2010-04-12 09:18:48 UTC (rev 36)
+++ www/the_basics.shtml	2010-04-12 11:19:53 UTC (rev 37)
@@ -16,13 +16,13 @@
 R>
 </code>
 
-<p>let's check the effect of the above actions.  our loggers are
-environments, so we can use for example <tt>ls</tt> and <tt>with</tt>
-to inspect them.  after this basic configuration, our logger has
-handlers and a level and it contains one handler.  this is enough for
-some simple logging to the console.  the default logging level of the
-root logger is <tt>INFO</tt> (20).  anything at severity lower
-than <tt>INFO</tt> will not be logged.</p>
+<p>let's check the effect of the above actions.  both our loggers and
+handlers are environments, so we can use for example <tt>ls</tt>
+and <tt>with</tt> to inspect them.  after this basic configuration,
+our logger has handlers and a level and it contains one handler.  this
+is enough for some simple logging to the console.  the default logging
+level of the root logger is <tt>INFO</tt> (20).  anything at severity
+lower than <tt>INFO</tt> will not be logged.</p>
 
 <code>
 R> <user>ls(getLogger())</user><br/>
@@ -30,8 +30,10 @@
 R> <user>with(getLogger(), level)</user><br/>
 INFO <br/>
 &nbsp; 20 <br/>
-R> <user>with(getLogger(), names(handlers))</user><br/>
-[1] "basic.stdout"<br/>
+R> <user>with(getLogger(), handlers)</user><br/>
+$basic.stdout<br/>
+&lt;environment: 0x........><br/>
+<br/>
 R> <user>loginfo('does it work?')</user><br/>
 2010-04-08 11:28:35 INFO::does it work?<br/>
 R> <user>logwarn('my %s is %d', 'name', 5)</user><br/>
@@ -65,8 +67,7 @@
 passing through a handler and having a severity lower than the level
 of the handler is ignored.  you can alter the level of a handler.
 this is what we do in the following lines: we alter the level of the
-default console handler 'basic.stdout' to 30 (<tt>WARN</tt>).  by the
-way, also handlers are environments.</p>
+default console handler 'basic.stdout' to 30 (<tt>WARN</tt>).  </p>
 
 <code>
 R> <user>addHandler(writeToConsole)</user><br/>



More information about the Logging-commits mailing list