loggr: Write a log message

Description Usage Arguments Examples

Description

A pipeable function for logging. The first argument is passed through the function unchanged, allowing loggr to be used

Usage

1
2
loggr(x, ..., .flags = NULL, .level = 0, .file = NULL,
  .timestamp = TRUE)

Arguments

x

An object.

...

Expressions to be logged.

.flags

A character vector. These flags are added to the logging statement. loggr_flags can be used to set this variable globally

.level

A integer. Specifies the importance of log. loggr_level sets the global importance level.Only statements with a level above the global level are logged

.file

A character string or a file connection. If NULL, statements are printed to standard output connection

.timestamp

A boolean. Whether to include a timestamp in the logging statement.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
iris_filtered = iris %>%
 loggr("I see you have, nrow(.), "rows") %>%
 filter(Species == "setosa") %>%
 loggr("And now you have, nrow(.), "rows")

x = rnorm(100) %>%
 loggr(length(.), "samples drawn", .flags=c("flag1", "flag2")) %>%

loggr_level(5)

y = x %>%
 loggr("This log isn't so important", .level = 1) %>%
 max %>%
 loggr("But maybe this one is", .level = 10)

erickramer/loggr documentation built on May 16, 2019, 8:28 a.m.