Skip to content

Commit b6fd07f

Browse files
committed
Update readme
1 parent 4219729 commit b6fd07f

File tree

2 files changed

+42
-64
lines changed

2 files changed

+42
-64
lines changed

README.Rmd

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ lgr$info("cars has %s rows", nrow(cars))
9595
cat(readLines(tf))
9696
```
9797

98-
By passing a named argument to `info()`, `warn()`, and co you can log not only
98+
By passing a named argument to the log function, you can log not only
9999
text but arbitrary R objects. Not all appenders support structured logging
100100
perfectly, but JSON does. This way you can create
101101
logfiles that are machine as well as (somewhat) human readable.
102102

103103
```{r}
104-
lgr$info("loading cars", "cars", rows = nrow(cars), cols = ncol(cars))
104+
lgr$info("loading %s", "cars", rows = nrow(cars), cols = ncol(cars), vector = c(1, 2, 3))
105105
cat(readLines(tf), sep = "\n")
106106
```
107107

@@ -148,21 +148,17 @@ lgr is stable and safe for use. I've been using it in production code for
148148
several years myself. There has been very little recent development because
149149
it's pretty stable and contains (nearly) all planned features.
150150

151-
Notable points that are not
151+
Notable points that are still planned (without specific ETA):
152152

153153
* Support for config files is heavily experimental and incomplete.
154154
This is an important basic feature, but I have not yet found a great way to
155155
support this in a generic way. For now, I recommend you come up with your own
156156
solution if you need to lgr to work in a production environment that relies
157157
on config files.
158158

159-
* The documentation should be mostly complete, but is not perfect. If there's
160-
something missing or something you don't understand - please ask (for example
161-
via a github issue).
162-
163-
* Please also check out the lgrExtra package for a variety of extra appenders
164-
[lgrExtra](https://github.com/s-fleck/lgrExtra) (that might not be as stable
165-
as the main lgr package itself).
159+
* Improve the documentation. The documentation should be mostly complete, but
160+
is not perfect. If there's something missing or something you don't understand,
161+
please ask (for example via a github issue).
166162

167163

168164
## Dependencies

README.md

Lines changed: 36 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![CRAN
77
status](https://www.r-pkg.org/badges/version/lgr)](https://cran.r-project.org/package=lgr)
88
[![Lifecycle:
9-
maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)
9+
maturing](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html)
1010

1111
lgr is a logging package for R built on the back of
1212
[R6](https://github.com/r-lib/R6) classes. It is designed to be
@@ -61,13 +61,13 @@ vignette.
6161

6262
``` r
6363
lgr$fatal("A critical error")
64-
#> FATAL [20:38:17.998] A critical error
64+
#> FATAL [11:32:48.843] A critical error
6565
lgr$error("A less severe error")
66-
#> ERROR [20:38:18.057] A less severe error
66+
#> ERROR [11:32:48.864] A less severe error
6767
lgr$warn("A potentially bad situation")
68-
#> WARN [20:38:18.072] A potentially bad situation
68+
#> WARN [11:32:48.868] A potentially bad situation
6969
lgr$info("iris has %s rows", nrow(iris))
70-
#> INFO [20:38:18.074] iris has 150 rows
70+
#> INFO [11:32:48.869] iris has 150 rows
7171

7272
# the following log levels are hidden by default
7373
lgr$debug("A debug message")
@@ -81,23 +81,22 @@ appender to log to a file with little effort.
8181
tf <- tempfile()
8282
lgr$add_appender(AppenderFile$new(tf, layout = LayoutJson$new()))
8383
lgr$info("cars has %s rows", nrow(cars))
84-
#> INFO [20:38:18.173] cars has 50 rows
84+
#> INFO [11:32:48.878] cars has 50 rows
8585
cat(readLines(tf))
86-
#> {"level":400,"timestamp":"2023-03-04 20:38:18","logger":"root","caller":"eval","msg":"cars has 50 rows"}
86+
#> {"level":400,"timestamp":"2025-07-13 11:32:48","logger":"root","caller":"eval","msg":"cars has 50 rows","rawMsg":"cars has %s rows"}
8787
```
8888

89-
By passing a named argument to `info()`, `warn()`, and co you can log
90-
not only text but arbitrary R objects. Not all appenders support
91-
structured logging perfectly, but JSON does. This way you can create
92-
logfiles that are machine as well as (somewhat) human readable.
89+
By passing a named argument to the log function, you can log not only
90+
text but arbitrary R objects. Not all appenders support structured
91+
logging perfectly, but JSON does. This way you can create logfiles that
92+
are machine as well as (somewhat) human readable.
9393

9494
``` r
95-
lgr$info("loading cars", "cars", rows = nrow(cars), cols = ncol(cars))
96-
#> Warning in (function (fmt, ...) : one argument not used by format 'loading cars'
97-
#> INFO [20:38:18.263] loading cars {rows: `50`, cols: `2`}
95+
lgr$info("loading %s", "cars", rows = nrow(cars), cols = ncol(cars), vector = c(1, 2, 3))
96+
#> INFO [11:32:48.893] loading cars {rows: `50`, cols: `2`, vector: (1, 2, 3)}
9897
cat(readLines(tf), sep = "\n")
99-
#> {"level":400,"timestamp":"2023-03-04 20:38:18","logger":"root","caller":"eval","msg":"cars has 50 rows"}
100-
#> {"level":400,"timestamp":"2023-03-04 20:38:18","logger":"root","caller":"eval","msg":"loading cars","rows":50,"cols":2}
98+
#> {"level":400,"timestamp":"2025-07-13 11:32:48","logger":"root","caller":"eval","msg":"cars has 50 rows","rawMsg":"cars has %s rows"}
99+
#> {"level":400,"timestamp":"2025-07-13 11:32:48","logger":"root","caller":"eval","msg":"loading cars","rawMsg":"loading %s","rows":50,"cols":2,"vector":[1,2,3]}
101100
```
102101

103102
For more examples please see the package
@@ -132,16 +131,22 @@ file.remove(logfile)
132131

133132
## Development status
134133

135-
lgr in general is stable and safe for use, but **the following features
136-
are still experimental**:
134+
lgr is stable and safe for use. I’ve been using it in production code
135+
for several years myself. There has been very little recent development
136+
because it’s pretty stable and contains (nearly) all planned features.
137137

138-
- Database appenders which are available from the separate package
139-
[lgrExtra](https://github.com/s-fleck/lgrExtra).
140-
- yaml/json config files for loggers (do not yet support all planned
141-
features)
142-
- The documentation in general. I’m still hoping for more R6-specific
143-
features in [roxygen2](https://github.com/r-lib/roxygen2) before I
144-
invest more time in object documentation.
138+
Notable points that are still planned (without specific ETA):
139+
140+
- Support for config files is heavily experimental and incomplete. This
141+
is an important basic feature, but I have not yet found a great way to
142+
support this in a generic way. For now, I recommend you come up with
143+
your own solution if you need to lgr to work in a production
144+
environment that relies on config files.
145+
146+
- Improve the documentation. The documentation should be mostly
147+
complete, but is not perfect. If there’s something missing or
148+
something you don’t understand, please ask (for example via a github
149+
issue).
145150

146151
## Dependencies
147152

@@ -175,40 +180,17 @@ Extra appenders (in the main package):
175180
- [glue](https://glue.tidyverse.org/) for a more flexible formatting
176181
syntax via LoggerGlue and LayoutGlue.
177182

178-
Extra appenders via [lgrExtra](https://github.com/s-fleck/lgrExtra):
179-
180-
- [DBI](https://github.com/r-dbi/DBI) for logging to databases. lgr is
181-
confirmed to work with the following backends:
182-
183-
- [RSQLite](https://github.com/r-dbi/RSQLite),
184-
- [RMariaDB](https://github.com/r-dbi/RMariaDB) for MariaDB and MySQL,
185-
- [RPostgres](https://cran.r-project.org/package=RPostgres),
186-
- [RJDBC](https://github.com/s-u/RJDBC) for DB2, and
187-
- [odbc](https://github.com/r-dbi/odbc) also for DB2.
188-
189-
In theory all DBI compliant database packages should work. If you are
190-
using lgr with a database backend, please report your (positive and
191-
negative) experiences, as database support is still somewhat
192-
experimental.
193-
194-
- [gmailr](https://cran.r-project.org/package=gmailr) or
195-
196-
- [sendmailR](https://cran.r-project.org/package=sendmailR) for email
197-
notifications.
198-
199-
- [RPushbullet](https://github.com/eddelbuettel/rpushbullet) for push
200-
notifications.
201-
202-
- [Rsyslog](https://cran.r-project.org/package=rsyslog) for logging to
203-
syslog on POSIX-compatible systems.
183+
Extra appenders via lgrExtra:
204184

205-
- [elastic](https://cran.r-project.org/package=elastic) for logging to
206-
ElasticSearch
185+
- For support for Elasticsearch, Dynatrace, Push- and Email
186+
notifications, etc… as well as the relevant dependencies please refer
187+
to the documentation of
188+
[lgrExtra](https://github.com/s-fleck/lgrExtra)
207189

208190
Other extra features:
209191

210192
- [yaml](https://CRAN.R-project.org/package=yaml) for configuring
211-
loggers via YAML files
193+
loggers via YAML files (experimental)
212194
- [crayon](https://github.com/r-lib/crayon) for colored console
213195
output.
214196
- [whoami](https://github.com/r-lib/whoami/blob/master/DESCRIPTION) for

0 commit comments

Comments
 (0)