lgr (version 0.3.3)

AppenderPushbullet: Send push-notifications via RPushbullet

Description

Send push notifications via pushbullet. This Appender keeps an in-memory buffer like AppenderBuffer. If the buffer is flushed, usually because an event of specified magnitude is encountered, all buffered events are concatenated to a single message that is sent to RPushbullet::pbPost(). The default behaviour is to push the last 7 log events in case a fatal event is encountered.

Arguments

Usage

x <- AppenderPushbullet$new(threshold = NA_integer_, flush_threshold = "fatal",
  layout = LayoutFormat$new(fmt = "%K %t> %m %f", timestamp_fmt = "%H:%M:%S"),
  subject_layout = LayoutFormat$new(fmt = "[LGR] %L: %m"), buffer_size = 6,
  recipients = NULL, email = NULL, channel = NULL, devices = NULL, apikey =
  NULL, filters = NULL)

x$add_filter(filter, name = NULL) x$append(event) x$filter(event) x$flush() x$format(color = FALSE, ...) x$remove_filter(pos) x$set_apikey(x) x$set_buffer_size(x) x$set_channel(x) x$set_devices(x) x$set_email(x) x$set_filters(filters) x$set_flush_threshold(level) x$set_layout(layout) x$set_recipients(x) x$set_should_flush(x) x$set_subject_layout(layout) x$set_threshold(level) x$show(threshold = NA_integer_, n = 20L)

x$apikey x$buffer_df x$buffer_dt x$buffer_events x$buffer_size x$channel x$data x$destination x$devices x$dt x$email x$filters x$flush_threshold x$layout x$recipients x$should_flush x$subject_layout x$threshold

Fields

apikey, recipients, email, channel, devices

See RPushbullet::pbPost()

buffer_size, set_buffer_size(x)

integer scalar >= 0 Number of LogEvents to buffer.

buffer_events, buffer_df, buffer_dt

The contents of the buffer as a list of LogEvents, a data.frame or a data.table.

flush_threshold, set_flush_threshold()

integer or character log level. Minimum event level that will trigger flushing of the buffer. This behaviour is implemented through should_flush(), and you can modify that function for different behaviour.

should_flush(event), set_should_flush(x)

A function with exactly one arguments: event. If the function returns TRUE, flushing of the buffer is triggered. Defaults to flushing if an event of level error or higher is registered.

dt

Get the log recorded by this Appender as a data.table with a maximum of buffer_size rows

data

Get the log recorded by this Appender as a data.frame

threshold, set_threshold(level)

character or integer scalar. The minimum log level that triggers this logger. See log_levels

layout, set_layout(layout)

a Layout that will be used for formatting the LogEvents passed to this Appender

destination

The output destination of the Appender in human-readable form (mainly for print output)

filters, set_filters(filters)

a list that may contain functions or any R object with a filter() method. These functions must have exactly one argument: event which will get passed the LogEvent when the Filterable's filter() method is invoked. If all of these functions evaluate to TRUE the LogEvent is passed on. Since LogEvents have reference semantics, filters can also be abused to modify them before they are passed on. Look at the source code of with_log_level() or with_log_value() for examples.

Methods

flush()

Manually trigger flushing of the buffer

show(n, threshold)

Show the last n log entries with a log level bellow threshold. The log entries will be formatted for console output via this Appenders Layout

append(event)

Tell the Appender to process a LogEvent event. This method is usually not called by the user, but invoked by a Logger

filter(event)

Determine whether the LogEvent x should be passed on to Appenders (TRUE) or not (FALSE). See also the active binding filters

add_filter(filter, name = NULL), remove_filter(pos)

Add or remove a filter. When adding a filter an optional name can be specified. remove_filter() can remove by position or name (if one was specified)

See Also

LayoutFormat, LayoutGlue

Other Appenders: AppenderBuffer, AppenderConsole, AppenderDbi, AppenderFileRotating, AppenderFile, AppenderGmail, AppenderJson, AppenderRjdbc, AppenderSendmail, AppenderSyslog, AppenderTable, Appender