https://github.com/mrcsparker/timber
R logging library that interfaces with syslog
https://github.com/mrcsparker/timber
Last synced: 2 months ago
JSON representation
R logging library that interfaces with syslog
- Host: GitHub
- URL: https://github.com/mrcsparker/timber
- Owner: mrcsparker
- Created: 2015-10-04T07:31:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-04T08:09:15.000Z (over 9 years ago)
- Last Synced: 2025-02-14T02:22:33.783Z (4 months ago)
- Language: C++
- Size: 5.44 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# timber
R logging library that interfaces with syslog.h
## Usage
Timber supports POSIX logging in R. All of the standard log message types
are available (LOG_EMERG, LOG_ALERT, LOG_CRIT, etc).More details can be found at http://linux.die.net/man/3/syslog
## Why would you use this?
Syslog has been around since the 1980s and it is still used in millions of *nix-based
systems all over the planet. It has a proven track record and, while it isn't perfect,
it works.Plus, if you are on a *nix (Unix, GNU/Linux), why not use the tools that are provided?
### Basic logging
```R
library(timber)# Create a new instance of Timber
t = Timber$new()# Write to the standard syslog
t$log(t$LOG_INFO, "This is a message")
t$log_err("uh oh")
```### Advanced logging
```R
library(timber)# Create a new instance of Timber
t = Timber$new()# open(name, option, facility)
# - open: Open a connection to the system logger
# - name: The name of your program. I am using 'Timber'. Can be any string.
# - option: flags to control the operation of syslog. You can pass a single flag
# or multiple using a `bitwOr`
# - facility: what type of program is logging the message. You can pass a single flag
# or multiple flags using a `bitwOr`
t$open("Timber", bitwOr(t$LOG_CONS, t$LOG_PID), t$LOG_SYSLOG)t$log(t$LOG_INFO, "This is another message")
t$log_err("uh oh")
# closes the descriptor being used to write to the system logger.
# This is optional.
t$close()
```## License
MIT