Title: | Interface to the 'syslog' System Logger |
---|---|
Description: | Functions to write messages to the 'syslog' system logger API, available on all 'POSIX'-compatible operating systems. Features include tagging messages with a priority level and application type, as well as masking (hiding) messages below a given priority level. |
Authors: | Aaron Jacobs [aut, cre], Crescendo Technology Ltd. [cph] |
Maintainer: | Aaron Jacobs <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.3 |
Built: | 2024-11-07 02:39:48 UTC |
Source: | https://github.com/atheriel/rsyslog |
Write messages to the system log via the POSIX syslog interface. Since this
is a thin wrapper around that interface, you may also want to take a look at
its
documentation. Note that neither open_syslog()
nor
close_syslog()
is actually required, but using them is good practice.
open_syslog( identifier, open_immediately = FALSE, include_pid = FALSE, fallback_to_console = FALSE, echo = FALSE, facility = NULL ) syslog(message, level = "INFO", facility = NULL) close_syslog()
open_syslog( identifier, open_immediately = FALSE, include_pid = FALSE, fallback_to_console = FALSE, echo = FALSE, facility = NULL ) syslog(message, level = "INFO", facility = NULL) close_syslog()
identifier |
A string identifying the application. |
open_immediately |
When |
include_pid |
When |
fallback_to_console |
Write to the system console (e.g.
|
echo |
Also log the message to standard error. Equivalent to using
|
facility |
The type of program doing the logging, according to the
guidelines in RFC 5424.
Generally one of |
message |
The message to write to the system log. |
level |
The priority level of the message. One of |
## Not run: open_syslog("my_script") syslog("Running script.", level = "INFO") syslog("Possible issue.", level = "WARNING") close_syslog() # Opening the syslog is not strictly necessary. You can # simply write a message and it will open the log with the # process name (likely "R") as the default. syslog("Hello from R!", level = "WARNING") close_syslog() ## End(Not run)
## Not run: open_syslog("my_script") syslog("Running script.", level = "INFO") syslog("Possible issue.", level = "WARNING") close_syslog() # Opening the syslog is not strictly necessary. You can # simply write a message and it will open the log with the # process name (likely "R") as the default. syslog("Hello from R!", level = "WARNING") close_syslog() ## End(Not run)
set_syslog_mask
can be used to prevent messages below a priority
level from being written to the system log.
set_syslog_mask(level)
set_syslog_mask(level)
level |
Mask (hide) messages below this priority level. One of
|
## Not run: open_syslog("my_script") syslog("This message is visible.", level = "INFO") set_syslog_mask("WARNING") syslog("No longer visible.", level = "INFO") syslog("Still visible.", level = "WARNING") close_syslog() ## End(Not run)
## Not run: open_syslog("my_script") syslog("This message is visible.", level = "INFO") set_syslog_mask("WARNING") syslog("No longer visible.", level = "INFO") syslog("Still visible.", level = "WARNING") close_syslog() ## End(Not run)