| AppenderSyslog {lgrExtra} | R Documentation | 
Log to the POSIX system log
Description
An Appender that writes to the syslog on supported POSIX platforms. Requires the rsyslog package.
Value
The $new() method returns an R6::R6 that inherits from
lgr::Appender and can be uses as an appender by a lgr::Logger.
Super classes
lgr::Filterable -> lgr::Appender -> AppenderSyslog
Public fields
syslog_levels.Either a named
charactervector or afunctionmapping lgr log_levels to rsyslog log levels. See$set_syslog_levels().
Active bindings
identifiercharacterscalar. A string identifying the process; ifNULLdefaults to the logger namesyslog_levels.Either a named
charactervector or afunctionmapping lgr log_levels to rsyslog log levels. See$set_syslog_levels().
Methods
Public methods
Inherited methods
Method new()
Usage
AppenderSyslog$new(
  identifier = NULL,
  threshold = NA_integer_,
  layout = LayoutFormat$new("%m"),
  filters = NULL,
  syslog_levels = c(CRITICAL = "fatal", ERR = "error", WARNING = "warn", INFO = "info",
    DEBUG = "debug", DEBUG = "trace")
)Method append()
Usage
AppenderSyslog$append(event)
Method set_syslog_levels()
Define conversion between lgr and syslog log levels
Usage
AppenderSyslog$set_syslog_levels(x)
Arguments
x- 
a named
charactervector mapping whose names are log levels as understood byrsyslog::syslog()and whose values are lgr log levels (eithercharacterornumeric)a
functionthat takes a vector of lgr log levels as input and returns acharactervector of log levels forrsyslog::syslog().
 
Method set_identifier()
Set a string to identify the process.
Usage
AppenderSyslog$set_identifier(x)
See Also
Other Appenders: 
AppenderDbi,
AppenderDt,
AppenderElasticSearch,
AppenderGmail,
AppenderPushbullet,
AppenderSendmail
Examples
if (requireNamespace("rsyslog", quietly = TRUE) && Sys.info()[["sysname"]] == "Linux") {
  lg <- lgr::get_logger("rsyslog/test")
  lg$add_appender(AppenderSyslog$new(), "syslog")
  lg$info("A test message")
  print(system("journalctl -t 'rsyslog/test'"))
  invisible(lg$config(NULL))  # cleanup
}