logger: Create Logger Objects

Description Usage Arguments Value See Also Examples

View source: R/create.logger.R

Description

This is the main interface for configuring logging behaviour. We adopt the well-known log4j etymology: Appenders are destinations (e.g. the console or a file) where messages are written, and the Layout is the format of the messages.

Usage

1
logger(threshold = "INFO", appenders = console_appender())

Arguments

threshold

The logging threshold level. Messages with a lower priority level will be discarded. See loglevel.

appenders

The logging appenders; both single appenders and a list() of them are supported. See appenders.

Value

An object of class "logger".

See Also

Appenders and Layouts for information on controlling the behaviour of the logger object.

Examples

1
2
3
4
5
6
7
# By default, messages are logged to the console at the
# "INFO" threshold.
logger <- logger()

info(logger, "Located nearest gas station.")
warn(logger, "Ez-Gas sensor network is not available.")
debug(logger, "Debug messages are suppressed by default.")

log4r documentation built on Nov. 4, 2021, 9:09 a.m.