View source: R/FutileLoggerUtils.R
sayInfo | R Documentation |
These are essentially the same as the level-specific loggers in
futile.logger
, except they each can take a vector of logger
names. The futile.logger
package makes it easy to log, and allows
logging to both a file and the console, but not with different thresholds.
The sayLevel
loggers described here support this as the default
case, but also support any combination of one or more loggers, possibly
differing at each point where a message is logged.
sayTrace(
msg,
...,
name = paste0(packageName(env = parent.frame()), c(".file", ".console")),
capture = FALSE
)
sayDebug(
msg,
...,
name = paste0(packageName(env = parent.frame()), c(".file", ".console")),
capture = FALSE
)
sayInfo(
msg,
...,
name = paste0(packageName(env = parent.frame()), c(".file", ".console")),
capture = FALSE
)
sayWarn(
msg,
...,
name = paste0(packageName(env = parent.frame()), c(".file", ".console")),
capture = FALSE
)
sayError(
msg,
...,
name = paste0(packageName(env = parent.frame()), c(".file", ".console")),
capture = FALSE
)
sayFatal(
msg,
...,
name = paste0(packageName(env = parent.frame()), c(".file", ".console")),
capture = FALSE
)
OFF
msg |
The message to print, possibly a string with |
... |
Extra arguments for use by |
name |
The logger names to use (a vector of strings). By default will
use |
capture |
By default (FALSE), extra object arguments are handled as
format variables for the message, which should contain a matching number of
sprintf variable symbols. If TRUE, then extra object arguments are handled
by the appender layout, by default printed on the next line following
|
An object of class integer
of length 1.
Whether or not a message is propagated depends on each logger's level
separately. If only one name is specified, this is essentially identical to a
flog.level
call. If no names are provided, by default will log
to two loggers: "package.file"
and
"package.console"
.
All loggers should be defined before being used in a log message. Since loggers are a hierarchical namespace based on the "." separator in the names, each undefined logger passed in causes a logging call to search up the tree of loggers looking for a "fall-back" logger. As a last resort, this will be logged by the root logger. This prevents messages being lost, but can result in the same message being logged multiple times.
To prevent a logger from logging anything, set its threshold to OFF
.
OFF
is exported as another constant for use with loggers and is a
higher priority than FATAL
No logging function can generate a message
with priority greater than FATAL
Note, this is not completely
consistent with the use of the other constants, where the string can be used.
"INFO"
and INFO
are treated similarly in most cases, whereas
"OFF"
and OFF
are not. Always use the constant OFF
(i.e.
the value 0) and not the string.
To ensure a logger logs everything, set its logging threshold to "TRACE"
. No
logging function can generate a message with priority lower than TRACE
Returns the message from the last logger named, may be NULL if that
logger does not log the message due to threshold issues and
flog.carp(TRUE)
is not set.
sayTrace()
: Print a message to specified loggers with
a threshold of TRACE
.
sayDebug()
: Print a message to specified loggers with
a threshold of DEBUG
or TRACE
.
sayInfo()
: Print a message to specified loggers with
a threshold of INFO
, DEBUG
or TRACE
.
sayWarn()
: Print a message to specified loggers with
a threshold of WARN
, INFO
, DEBUG
or TRACE
.
sayError()
: Print a message to specified loggers with a threshold of
ERROR
, WARN
, INFO
, DEBUG
or TRACE
.
sayFatal()
: Print a message to specified loggers with a threshold of
FATAL
ERROR
, WARN
, INFO
, DEBUG
or
TRACE
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.