[Logging-commits] r27 - www

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 8 17:05:52 CEST 2010


Author: mariotomo
Date: 2010-04-08 17:05:52 +0200 (Thu, 08 Apr 2010)
New Revision: 27

Added:
   www/hierarchical_loggers.R
   www/logging_to_file.R
   www/the_basics.R
Modified:
   www/sample_session.html
Log:
adding the sample scripts


Added: www/hierarchical_loggers.R
===================================================================
--- www/hierarchical_loggers.R	                        (rev 0)
+++ www/hierarchical_loggers.R	2010-04-08 15:05:52 UTC (rev 27)
@@ -0,0 +1,29 @@
+##***********************************************************************
+## this program is free software: you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation, either version 3 of the
+## License, or (at your option) any later version.
+##
+## this program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see
+## <http://www.gnu.org/licenses/>.
+##
+## $Id$
+
+library(logging)
+basicConfig()
+
+with(getLogger(logger=''), names(handlers))
+with(getLogger('libro'), names(handlers))
+
+logReset()
+addHandler(writeToConsole, logger='libro.romanzo')
+loginfo('chiarastella', logger='libro.romanzo.campanile')
+loginfo('memories of a survivor', logger='libro.romanzo.lessing')
+logwarn('talking to a upper level logger', logger='libro')
+logerror('talking to an unrelated logger', logger='rivista.cucina')


Property changes on: www/hierarchical_loggers.R
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: www/logging_to_file.R
===================================================================
--- www/logging_to_file.R	                        (rev 0)
+++ www/logging_to_file.R	2010-04-08 15:05:52 UTC (rev 27)
@@ -0,0 +1,27 @@
+##***********************************************************************
+## this program is free software: you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation, either version 3 of the
+## License, or (at your option) any later version.
+##
+## this program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see
+## <http://www.gnu.org/licenses/>.
+##
+## $Id$
+
+library(logging)
+logReset()
+
+basicConfig(level='FINEST')
+addHandler(writeToFile, file="~/testing.log", level='DEBUG')
+with(getLogger(), names(handlers))
+loginfo('test %d', 1)
+logdebug('test %d', 2)
+logwarn('test %d', 3)
+logfinest('test %d', 4)


Property changes on: www/logging_to_file.R
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: www/sample_session.html
===================================================================
--- www/sample_session.html	2010-04-08 14:40:05 UTC (rev 26)
+++ www/sample_session.html	2010-04-08 15:05:52 UTC (rev 27)
@@ -10,8 +10,12 @@
 and expect from this library.  this text is directed to scripts
 authors who want to be able to log the activity of their programs.</p>
 
-<p>this library attempts to be as compatible as possible (that is: as
-it was conceivable to the author) to the
+<p>this page is organized in sections.  each section can be seen and
+tried out as a separate R session.  at the end of the section there's
+a link to a R script with the R instructions tried in the section.</p>
+
+<p>this logging library attempts to be as compatible as possible (that
+is: as it was conceivable to the author) to the
 standard <a href="http://docs.python.org/library/logging.html">Python
 logging</a> library.  if you are accustomed to that logging library,
 this one will look familiar to you.</p>
@@ -91,6 +95,8 @@
 R> 
 </code>
 
+<p><a href="the_basics.R">code</a></p>
+
 <h4>hierarchical loggers</h4>
 
 <p>in the previous section we have worked -implicitly- with one
@@ -145,6 +151,8 @@
 "::".  between the two ":" there's the name of the logger that
 received the logging record in the first place.</p>
 
+<p><a href="hierarchical_loggers.R">code</a></p>
+
 <h4>logging to file</h4>
 
 <p>actually the name of this paragraph is misleading.  a more correct
@@ -195,6 +203,8 @@
 our file handler had threshold <tt>DEBUG</tt> so it handled also the
 second record.  the fourth record was dropped by both handlers.</p>
 
+<p><a href="logging_to_file.R">code</a></p>
+
 <h4>formatting your log records</h4>
 
 </body>

Added: www/the_basics.R
===================================================================
--- www/the_basics.R	                        (rev 0)
+++ www/the_basics.R	2010-04-08 15:05:52 UTC (rev 27)
@@ -0,0 +1,39 @@
+##***********************************************************************
+## this program is free software: you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation, either version 3 of the
+## License, or (at your option) any later version.
+##
+## this program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the this program.  If not, see
+## <http://www.gnu.org/licenses/>.
+##
+## $Id$
+
+library(logging)
+basicConfig()
+
+ls(getLogger())
+with(getLogger(), level)
+with(getLogger(), names(handlers))
+loginfo('does it work?')
+logwarn('%s %d', 'my name is', 5)
+logdebug('I am a silent child')
+
+addHandler(writeToConsole)
+with(getLogger(), names(handlers))
+loginfo('test')
+logwarn('test')
+removeHandler('writeToConsole')
+logwarn('test')
+
+addHandler(writeToConsole)
+setLevel(30, getHandler('basic.stdout'))
+loginfo('test')
+logwarn('test')
+with(getHandler('basic.stdout'), level)


Property changes on: www/the_basics.R
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Logging-commits mailing list