AppenderRedis writes log messages to a Redis database.
This lgr::Appender is created internally by RushWorker when logger thresholds are passed via rush_plan().
Value
Object of class R6::R6Class and AppenderRedis with methods for writing log events to Redis databases.
Super classes
lgr::Filterable -> lgr::Appender -> lgr::AppenderMemory -> AppenderRedis
Methods
Inherited methods
lgr::Filterable$add_filter()lgr::Filterable$filter()lgr::Filterable$remove_filter()lgr::Filterable$set_filters()lgr::Appender$set_layout()lgr::Appender$set_threshold()lgr::AppenderMemory$append()lgr::AppenderMemory$clear()lgr::AppenderMemory$format()lgr::AppenderMemory$set_buffer_size()lgr::AppenderMemory$set_flush_on_exit()lgr::AppenderMemory$set_flush_on_rotate()lgr::AppenderMemory$set_flush_threshold()lgr::AppenderMemory$set_should_flush()lgr::AppenderMemory$show()
AppenderRedis$new()
Creates a new instance of this R6 class.
Usage
AppenderRedis$new(
config,
key,
threshold = NA_integer_,
layout = lgr::LayoutJson$new(timestamp_fmt = "%Y-%m-%d %H:%M:%OS3"),
buffer_size = 0,
flush_threshold = "error",
flush_on_exit = TRUE,
flush_on_rotate = TRUE,
should_flush = NULL,
filters = NULL
)Arguments
config(redux::redis_config)
Redis configuration options.key(
character(1))
Key of the list holding the log messages in the Redis data store.threshold(
integer(1)|character(1))
Threshold for the log messages.layout(lgr::Layout)
Layout for the log messages.buffer_size(
integer(1))
Size of the buffer.flush_threshold(
character(1))
Threshold for flushing the buffer.flush_on_exit(
logical(1))
Flush the buffer on exit.flush_on_rotate(
logical(1))
Flush the buffer on rotate.should_flush(
function)
Function that determines if the buffer should be flushed.filters(
list)
List of filters.
Examples
if (redux::redis_available()) {
config_local = redux::redis_config()
rush_plan(
config = config_local,
n_workers = 2,
lgr_thresholds = c(rush = "info"))
rush = rsh(network_id = "test_network")
rush
}
#>
#> ── <Rush> ──────────────────────────────────────────────────────────────────────
#> • Running Workers: 0
#> • Queued Tasks: 0
#> • Running Tasks: 0
#> • Finished Tasks: 0
#> • Failed Tasks: 0