Description Arguments Usage Details Value Author(s) See Also Examples
Provides functions for adding and removing appenders.
... |
Used internally by lambda.r |
# Get the appender for the given logger
flog.appender(name) %::% character : Function
flog.appender(name='ROOT')
# Set the appender for the given logger
flog.appender(fn, name='ROOT')
# Print log messages to the console
appender.console()
# Write log messages to a file
appender.file(file)
# Write log messages to console and a file
appender.tee(file)
Appenders do the actual work of writing log messages to some target.
To use an appender in a logger, you must register it to a given logger.
Use flog.appender to both access and set appenders.
The ROOT logger by default uses appender.console.
appender.console is a function that writes to the console.
No additional arguments are necessary when registering the appender
via flog.appender.
appender.file writes to a file, so you must pass an additional file
argument to the function. To change the file name, just call
flog.appender(appender.file(file)) again with a new file name.
To use your own appender create a function that takes a single argument,
which represents the log message. You need to pass a function reference to
flog.appender.
appender.tee writes to both the console and file.
When getting the appender, flog.appender returns the appender
function. When setting an appender, flog.appender has no
return value.
Brian Lee Yung Rowe
1 2 3 4 5 6 7 8 | ## Not run:
flog.appender(appender.console(), name='my.logger')
# Set an appender to the logger named 'my.package'. Any log operations from
# this package will now use this appender.
flog.appender(appender.file('my.package.out'), 'my.package')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.