[Logging-commits] r90 - www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 4 10:51:48 CEST 2011


Author: mariotomo
Date: 2011-08-04 10:51:48 +0200 (Thu, 04 Aug 2011)
New Revision: 90

Added:
   www/logger_objects.shtml
   www/section.php
Removed:
   www/formatting_your_log_records.php
   www/hierarchical_loggers.php
   www/logging_to_file.php
   www/the_basics.php
   www/writing_your_own_handlers.php
Modified:
   www/hierarchical_loggers.shtml
   www/sample_session.php
   www/the_basics.shtml
Log:
restructuring php pages


Deleted: www/formatting_your_log_records.php
===================================================================
--- www/formatting_your_log_records.php	2011-08-03 14:13:32 UTC (rev 89)
+++ www/formatting_your_log_records.php	2011-08-04 08:51:48 UTC (rev 90)
@@ -1,19 +0,0 @@
-<html>
-<head>
-<title>tutorial : formatting your log records</title>
-<link href="additions.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-
-<blockquote>
-<p>
-<a href="sample_session.php">[back to the tutorial]</a> &nbsp;
-<a href="logging_to_file.php">[previous session]</a> &nbsp;
-<a href="writing_your_own_handlers.php">[next session]</a>
-</p>
-</blockquote>
-
-<?php include("formatting_your_log_records.shtml"); ?> 
-
-</body>
-</html>

Deleted: www/hierarchical_loggers.php
===================================================================
--- www/hierarchical_loggers.php	2011-08-03 14:13:32 UTC (rev 89)
+++ www/hierarchical_loggers.php	2011-08-04 08:51:48 UTC (rev 90)
@@ -1,20 +0,0 @@
-<html>
-<head>
-<title>tutorial : hierarchical loggers</title>
-<link href="additions.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-
-<blockquote>
-<p>
-<a href="sample_session.php">[back to the tutorial]</a> &nbsp;
-<a href="the_basics.php">[previous session]</a> &nbsp;
-<a href="logging_to_file.php">[next session]</a>
-</p>
-</blockquote>
-
-
-<?php include("hierarchical_loggers.shtml"); ?> 
-
-</body>
-</html>

Modified: www/hierarchical_loggers.shtml
===================================================================
--- www/hierarchical_loggers.shtml	2011-08-03 14:13:32 UTC (rev 89)
+++ www/hierarchical_loggers.shtml	2011-08-04 08:51:48 UTC (rev 90)
@@ -35,8 +35,12 @@
 <code>
 R> <user>logReset()</user><br/>
 R> <user>addHandler(writeToConsole, logger='libro.romanzo')</user><br/>
-R> <user>loginfo('chiarastella', logger='libro.romanzo.campanile')</user><br/>
-2010-04-08 11:18:59 INFO:libro.romanzo.campanile:chiarastella<br/>
+R> <user>loginfo('Ma cos'è questo amore?', logger='libro.romanzo.campanile')</user><br/>
+2010-04-08 11:18:59 INFO:libro.romanzo.campanile:Ma cos'è questo amore?<br/>
+R> <user>loginfo('Se la luna mi porta fortuna', logger='libro.romanzo.campanile')</user><br/>
+2010-04-08 11:19:05 INFO:libro.romanzo.campanile:Se la luna mi porta fortuna<br/>
+R> <user>loginfo('Giovanotti, non esageriamo!', logger='libro.romanzo.campanile')</user><br/>
+2010-04-08 11:19:12 INFO:libro.romanzo.campanile:Giovanotti, non esageriamo!<br/>
 R> <user>loginfo('memories of a survivor', logger='libro.romanzo.lessing')</user><br/>
 2010-04-08 11:22:06 INFO:libro.romanzo.lessing:memories of a survivor<br/>
 R> <user>logwarn('talking to a hierarchically upper logger', logger='libro')</user><br/>

Added: www/logger_objects.shtml
===================================================================
--- www/logger_objects.shtml	                        (rev 0)
+++ www/logger_objects.shtml	2011-08-04 08:51:48 UTC (rev 90)
@@ -0,0 +1,29 @@
+
+<h4>logger objects</h4>
+
+<p>in the last example box in the previous section we have sent
+logging records to the 'libro.romanzo.campanile' logger.  we have done
+this by invoking the global loginfo function, passing it the name of
+the logger.  this is only practical if you are logging to the root
+logger or if you are using many different loggers, not if you are
+sending, as in our example, more records to the same logger.  if you
+are talking the whole time to the same logger, you do not want to have
+to repeat the name of the logger each time you send it a record.
+
+<p>the solution to this is in the object oriented approach taken in
+this logging library.  the getLogger() function returns a Logger
+object, which, since we are using Reference Classes, is itself an
+environment.  in the previous examples we have only used the fact that
+Logger objects are environments, let's now have a look at what more
+they offer.
+
+<code>
+> <user>class(getLogger())</user><br/>
+[1] "Logger"<br/>
+attr(,"package")<br/>
+[1] "logging"<br/>
+> <user>is.environment(getLogger())</user><br/>
+[1] TRUE<br/>
+> 
+</code>
+

Deleted: www/logging_to_file.php
===================================================================
--- www/logging_to_file.php	2011-08-03 14:13:32 UTC (rev 89)
+++ www/logging_to_file.php	2011-08-04 08:51:48 UTC (rev 90)
@@ -1,20 +0,0 @@
-<html>
-<head>
-<title>tutorial : logging to file</title>
-<link href="additions.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-
-<blockquote>
-<p>
-<a href="sample_session.php">[back to the tutorial]</a> &nbsp;
-<a href="hierarchical_loggers.php">[previous session]</a> &nbsp;
-<a href="formatting_your_log_records.php">[next session]</a>
-</p>
-</blockquote>
-
-
-<?php include("logging_to_file.shtml"); ?> 
-
-</body>
-</html>

Modified: www/sample_session.php
===================================================================
--- www/sample_session.php	2011-08-03 14:13:32 UTC (rev 89)
+++ www/sample_session.php	2011-08-04 08:51:48 UTC (rev 90)
@@ -21,15 +21,17 @@
 a link to a R script with the R instructions tried in the section.</p>
 
 <p>the same information, one page at a time:
-<a href="the_basics.php">[the basics]</a>
-<a href="hierarchical_loggers.php">[hierarchical loggers]</a>
-<a href="logging_to_file.php">[logging to file]</a>
-<a href="formatting_your_log_records.php">[formatting your log records]</a>
-<a href="writing_your_own_handlers.php">[writing your own handlers]</a>
+<a href="section.php?page=1">[the basics]</a>
+<a href="section.php?page=2">[hierarchical loggers]</a>
+<a href="section.php?page=3">[logger objects]</a>
+<a href="section.php?page=4">[logging to file]</a>
+<a href="section.php?page=5">[formatting your log records]</a>
+<a href="section.php?page=6">[writing your own handlers]</a>
 </p>
 
 <?php include("the_basics.shtml"); ?> 
 <?php include("hierarchical_loggers.shtml"); ?> 
+<?php include("logger_objects.shtml"); ?> 
 <?php include("logging_to_file.shtml"); ?> 
 <?php include("formatting_your_log_records.shtml"); ?> 
 <?php include("writing_your_own_handlers.shtml"); ?> 

Added: www/section.php
===================================================================
--- www/section.php	                        (rev 0)
+++ www/section.php	2011-08-04 08:51:48 UTC (rev 90)
@@ -0,0 +1,29 @@
+<html>
+<?php
+
+$pages = array(1 => "the_basics",
+2 => "hierarchical_loggers",
+3 => "logger_objects",
+4 => "logging_to_file",
+5 => "formatting_your_log_records",
+6 => "writing_your_own_handlers");
+
+?>
+<head>
+<title>tutorial : <?php echo $pages[(int)$_GET['page']]; ?></title>
+<link href="additions.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+
+<blockquote>
+<p>
+<a href="sample_session.php">[back to the tutorial]</a> &nbsp;
+<?php if($_GET['page'] > 1) { echo "<a href=\"section.php?page="; echo (int)$_GET['page'] - 1; echo "\">"; } ?>[previous session]<?php if($_GET['page'] > 1) echo "</a>"; ?> &nbsp;
+<?php if($_GET['page'] < 6) { echo "<a href=\"section.php?page="; echo (int)$_GET['page'] + 1; echo "\">"; } ?>[next session]<?php if($_GET['page'] < 6) echo "</a>"; ?> &nbsp;
+</p>
+</blockquote>
+
+<?php include($pages[(int)$_GET['page']] . ".shtml"); ?> 
+
+</body>
+</html>

Deleted: www/the_basics.php
===================================================================
--- www/the_basics.php	2011-08-03 14:13:32 UTC (rev 89)
+++ www/the_basics.php	2011-08-04 08:51:48 UTC (rev 90)
@@ -1,20 +0,0 @@
-<html>
-<head>
-<title>tutorial : the basics</title>
-<link href="additions.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-
-<blockquote>
-<p>
-<a href="sample_session.php">[back to the tutorial]</a> &nbsp;
-[previous session] &nbsp;
-<a href="hierarchical_loggers.php">[next session]</a>
-</p>
-</blockquote>
-
-
-<?php include("the_basics.shtml"); ?> 
-
-</body>
-</html>

Modified: www/the_basics.shtml
===================================================================
--- www/the_basics.shtml	2011-08-03 14:13:32 UTC (rev 89)
+++ www/the_basics.shtml	2011-08-04 08:51:48 UTC (rev 90)
@@ -22,7 +22,10 @@
 
 <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,
+and <tt>with</tt> to inspect them (don't worry if you get more
+elements than shown here, I'll come back to them later).
+
+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
@@ -31,10 +34,10 @@
 <code>
 R> <user>ls(getLogger())</user><br/>
 [1] "handlers" "level"<br/>
-R> <user>with(getLogger(), level)</user><br/>
+R> <user>getLogger()[['level']]</user><br/>
 INFO <br/>
 &nbsp; 20 <br/>
-R> <user>with(getLogger(), handlers)</user><br/>
+R> <user>getLogger()[['handlers']]</user><br/>
 $basic.stdout<br/>
 &lt;environment: 0x........><br/>
 <br/>
@@ -53,7 +56,7 @@
 
 <code>
 R> <user>addHandler(writeToConsole)</user><br/>
-R> <user>with(getLogger(), names(handlers))</user><br/>
+R> <user>names(getLogger()[['handlers']])</user><br/>
 [1] "basic.stdout"   "writeToConsole"<br/>
 R> <user>loginfo('test')</user><br/>
 2010-04-07 11:31:06 INFO::test<br/>
@@ -81,10 +84,10 @@
 2011-08-03 15:59:13 WARNING::test<br/>
 R> <user>loginfo('test')</user><br/>
 2011-08-03 15:59:18 INFO::test<br/>
-R> <user>with(getHandler('basic.stdout'), level)</user><br/>
+R> <user>getHandler('basic.stdout')[['level']]</user><br/>
 WARN <br/>
   30 <br/>
-R> <user>with(getHandler('writeToConsole'), level)</user><br/>
+R> <user>getHandler('writeToConsole')[['level']]</user><br/>
 INFO <br/>
   20 <br/>
 </code>

Deleted: www/writing_your_own_handlers.php
===================================================================
--- www/writing_your_own_handlers.php	2011-08-03 14:13:32 UTC (rev 89)
+++ www/writing_your_own_handlers.php	2011-08-04 08:51:48 UTC (rev 90)
@@ -1,20 +0,0 @@
-<html>
-<head>
-<title>tutorial : writing your own handlers</title>
-<link href="additions.css" rel="stylesheet" type="text/css" />
-</head>
-<body>
-
-<blockquote>
-<p>
-<a href="sample_session.php">[back to the tutorial]</a> &nbsp;
-<a href="formatting_your_log_records.php">[previous session]</a> &nbsp;
-[next session]
-</p>
-</blockquote>
-
-
-<?php include("writing_your_own_handlers.shtml"); ?> 
-
-</body>
-</html>



More information about the Logging-commits mailing list