as.data.frame.LogEvent {lgr} | R Documentation |
Coerce LogEvents to Data Frames
Description
Coerce LogEvents to data.frames
, data.tables
,
or tibbles
.
Usage
## S3 method for class 'LogEvent'
as.data.frame(
x,
row.names = NULL,
optional = FALSE,
stringsAsFactors = FALSE,
...,
box_if = function(.) !(is.atomic(.) && identical(length(.), 1L)),
cols_expand = NULL
)
as.data.table.LogEvent(
x,
...,
box_if = function(.) !(is.atomic(.) && identical(length(.), 1L)),
cols_expand = "msg"
)
as_tibble.LogEvent(
x,
...,
box_if = function(.) !(is.atomic(.) && identical(length(.), 1L)),
cols_expand = "msg"
)
Arguments
x |
any R object. |
row.names |
|
optional |
currently ignored and only included for compatibility. |
stringsAsFactors |
|
... |
passed on to |
box_if |
a |
cols_expand |
|
See Also
data.table::data.table, tibble::tibble
Examples
lg <- get_logger("test")
lg$info("lorem ipsum")
as.data.frame(lg$last_event)
lg$info("LogEvents can store any custom log values", df = iris)
as.data.frame(lg$last_event)
head(as.data.frame(lg$last_event)$df[[1]])
# how boxing works
# by default non-scalars are boxed
lg$info("letters", letters = letters)
as.data.frame(lg$last_event)
# this behaviour can be modified by supplying a custom boxing function
as.data.frame(lg$last_event, box_if = function(.) FALSE)
as.data.frame(lg$last_event, cols_expand = "letters")
# The `msg` argument of a log event is always vectorized
lg$info(c("a vectorized", "log message"))
as.data.frame(lg$last_event)
lg$config(NULL)