Learn R Programming

logging (version 0.4-13)

logging-package: a tentative logging package

Description

a logging package emulating the python logging package.

What you find here behaves similarly to what you also find in Python. This includes hierarchic loggers, multiple handlers at each logger, the possibility to specify a formatter for each handler (one default formatter is given), same levels (names and numeric values) as Python's logging package, a simple logging.BasicConfig function to quickly put yourself in a usable situation...

This package owes a lot to Brian Lee Yung Rowe's futile package and the documentation of the Python logging package.

Arguments

Details

ll{ Package: logging Version: 0.2-9108 Date: 2010-01-14 License: GPL (>=2) Depends: R (>= 2.9.2) Built: R 2.9.2; ; 2010-01-27 12:24:58 UTC; unix }

Index: basicConfig bootstrapping the logging package

addHandler add a handler to a logger getLogger set defaults and get current values for a logger removeHandler remove a handler from a logger setLevel set logging.level for a logger

to use this package, include logging instructions in your code, possibly like this: logging::basicConfig() logging::addHandler(logging::writeToFile, name="company", file="sample.log") logging::info("hello world", logger="") logging::warn("hello company", logger="company.module")

the basicConfig function adds a console handler to the root logger, while the explicitly called addHandler adds a file handler to the 'company' logger. the effect of the above example is two lines on the console and just one line in the sample.log file.

References

the python logging module, at http://docs.python.org/library/logging.html

See Also

http://cran.r-project.org/web/packages/futile/index.html