View source: R/FutileLoggerUtils.R
initSayLoggers | R Documentation |
Sets up the default "package.console"
and
"package.file"
loggers. Use the saylevel
function
to log simultaneously to them. If you log from a script or a console and
don't specify the log file, it will write to the probably hidden file
‘".log"’. Allowed log levels are, in order of decreasing importance:
OFF
, FATAL
, ERROR
, WARN
, INFO
,
DEBUG
, TRACE
. Messages logged to the console will be just the
messages by default, messages logged to a file will be prepended with the
log level and the date. This can be changed by modifying the layout
parameters.
initSayLoggers(
file = packageName(env = parent.frame()) %p% ".log",
fileLevel = WARN,
consoleLevel = INFO,
fileLayout = layout.format("~l [~t] ~m"),
consoleLayout = layout.format("~m")
)
file |
The name of the log file, by default ‘"package.log"’
where package is guessed using |
fileLevel |
Only messages at least this important will be saved to the
log file, by default |
consoleLevel |
Only messages at least this important will be printed to the
console, by default |
fileLayout |
The layout string to use with messages logged to the log
file. By default this See |
consoleLayout |
The layout string to use with messages logged to the
console. See |
Nothing, called only for its side effect of initializing loggers.
futile.logger::flog.layout, futile.logger::flog.logger
## Not run:
# Default settings
initSayLoggers()
# Won't be logged
sayDebug('Initialized logging.')
# Logged only to console, not file
sayInfo('Welcome!')
#> Welcome!
# Logged to console and file.
sayWarn("This conversation is being monitored.")
#> This conversation is being monitored.
#> [In log file]
#> WARN [YYYY-MM-DD hh::mm::ss TZ] This conversation is being monitored.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.