Code Monkey home page Code Monkey logo

rsyslog's Introduction

rsyslog

CRAN status

rsyslog is a very simple R package to interface with syslog -- a system logging interface available on all POSIX-compatible operating systems.

Installation

To get the latest stable version from CRAN:

install.packages("rsyslog")

If you need access to in-development features, you can install the package directly from GitHub:

# install.packages("devtools")
devtools::install_github("atheriel/rsyslog")

Usage

Using rsyslog closely resembles using the syslog API, so it should be familiar if you have previous experience with syslog.

Messages are sent to the system log with the syslog() function. You can also (optionally) configure how messages are written with open_syslog() and close any open connection with close_syslog().

open_syslog("my_script")
syslog("Running script.", level = "INFO")
syslog("Possible issue.", level = "WARNING")
close_syslog()

To see what this has printed to the system log on systemd-based Linux distributions (including Ubuntu), you can use the journalctl program:

$ journalctl --identifier my_script
-- Logs begin at Mon 2018-06-25 14:48:12 UTC, end at Mon 2018-06-25 15:35:02 UTC. --
Jun 25 15:10:18 user my_script[4467]: Running script.
Jun 25 15:10:18 user my_script[4467]: Possible issue.

Opening and closing the system log is not strictly necessary (though it is good practice). The following will work as well:

# Uses the process name (likely "R" or "rsession") as the identifier.
syslog("Hello from R!", level = "WARNING")

If you wish to control the visibility of messages by priority level (for example, to hide debug messages), use set_syslog_mask():

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()

License

The package is licensed under the GPL, version 2 or later.

rsyslog's People

Contributors

atheriel avatar

Stargazers

Andrew Allen Bruce avatar  avatar Luke Smith avatar Jimmy Briggs avatar An Chu avatar AM avatar novica avatar Srikanth K S avatar Leo Lee avatar Xiangyun Huang avatar Roel Hogervorst avatar mark padgham avatar Kestutis Vinciunas avatar John Blischak avatar Richard Iannone avatar  avatar  avatar Stefan Fleck avatar Matt Bannert avatar  avatar Mauricio Pasquier Juan avatar Colin Fay avatar Dmitry Selivanov avatar Artem Klevtsov avatar Christophe Dervieux avatar Shape avatar

Watchers

James Cloos avatar  avatar Shape avatar  avatar

Forkers

mdr95

rsyslog's Issues

Document workaround for "package suggested but not available" RMD check result on Windows if used in another package

If I use the rsyslog package in another package by declaring a Suggests dependency R CMD check --as-cran reports:

Package suggested but not available: 'rsyslog'

This is caused by the fact that the rsyslog pkg is only available for POSIX-enabled architectures (Linux etc.), but not for Windows (see OS_type: unix in the DESCRIPTION file).

Despite rsyslog being in the Suggests section of the DESCRIPTION file it is not optional as the Writing R extensions documentation claims:
> 1.1.3.1 Suggested packages
> Note that someone wanting to run the examples/tests/vignettes may not have a suggested package available (and it may not even be possible to install it for that platform).

This makes CRAN releases of packages that reference rsyslog more complicated.
I guess currently you have to ask for an exception from the rule that R CMD check shall not show any findings...

It would be great to find and document a solution for this problem eg. in the README file here.

For an example of a real CRAN package that is affected by this problem see futile.logger:

zatonovo/futile.logger#98 (comment)

BTW: I think asking for an explanation and possible solutions at the r-devel mailing list could be a good starting point (I could initiate this)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.