Is there any standard logging package for R? [clos

2019-01-21 06:38发布

I am looking for the standard (if any) logging package for R, and some sample usage?

I also don't see any among the packages listed: http://cran.r-project.org/web/packages/

标签: logging r
7条回答
家丑人穷心不美
2楼-- · 2019-01-21 06:47

I suggest the futile.logger package, it implements multiple hierarchical loggers with formatted output strings and you can send the output different ways. It also implements per-package loggers naturally.

查看更多
爷、活的狠高调
3楼-- · 2019-01-21 06:48

The in-built (package base) functions are "warning", "message", "stop". These functions support multiple languages. If you want to log to a file, maybe you could use these functions together with "sink".

Searching with RSeek brought up the package futile with a logger functionality.

查看更多
啃猪蹄的小仙女
4楼-- · 2019-01-21 06:51

At the moment, there is still no native library for logging. But there are four of them available on CRAN:

1) logging
- simple & log4j-like
- resembles standard Python library
- not maintaining since 2013, some issues detected upper

2) futile.logger (recommended! I am also using it)
- actively maintaining
- supports json error logging
- similar semantics to Python’s logging as well as log4j-like
- may be complicated

3) log4r
- easy and log4j-like
- not being maintained since 2014

4) luzlogr
- supersimple - (open, write, close file)

查看更多
戒情不戒烟
5楼-- · 2019-01-21 07:02

I just submitted a logging package to CRAN. it is based on some parts of an older version of the 'futile' package (by Brian Lee Yung Rowe).

You find the logging package:

It mimics the standard python logging package, but please be careful if you decide to use it. I also attempted to document it by example, the package home page on R-Forge points to a couple of possible usage sessions.

Any feedback will be read with interest!

查看更多
爷的心禁止访问
6楼-- · 2019-01-21 07:02

I'm not aware of any, so I was about to release a wrapper for log4j in the next few days (I've been testing it for a while now). I'll let you know when it's available.

查看更多
贪生不怕死
7楼-- · 2019-01-21 07:08

A simpler alternative compared to logging and futile.logger:

log4r (cran, github)

The log4r package is meant to provide a clean, lightweight object-oriented approach to logging in R based roughly on the widely emulated log4j API. The example code below shows how the logger is used in practice to print output to a simple plaintext log file.

查看更多
登录 后发表回答