AppenderPushbullet: Send push-notifications via RPushbullet

AppenderPushbulletR Documentation

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 behavior is to push the last 7 log events in case a fatal event is encountered.

Value

The $new() method returns an R6::R6 that inherits from lgr::Appender and can be uses as an appender by a lgr::Logger.

Super classes

lgr::Filterable -> lgr::Appender -> lgr::AppenderMemory -> lgrExtra::AppenderDigest -> AppenderPushbullet

Active bindings

apikey

see RPushbullet::pbPost()

recipients

see RPushbullet::pbPost()

email

see RPushbullet::pbPost()

channel

see RPushbullet::pbPost()

devices

see RPushbullet::pbPost()

Methods

Public methods

Inherited methods

Method new()

Usage
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 = getOption("rpushbullet.key"),
  filters = NULL
)
Arguments
threshold, flush_threshold, layout, buffer_size

see AppenderBuffer

subject_layout

A lgr::LayoutFormat object.

recipients, email, channel, devices, apikey

see RPushbullet::pbPost


Method flush()

Usage
AppenderPushbullet$flush()

Method set_apikey()

Usage
AppenderPushbullet$set_apikey(x)

Method set_recipients()

Usage
AppenderPushbullet$set_recipients(x)

Method set_email()

Usage
AppenderPushbullet$set_email(x)

Method set_channel()

Usage
AppenderPushbullet$set_channel(x)

Method set_devices()

Usage
AppenderPushbullet$set_devices(x)

See Also

LayoutFormat, LayoutGlue

Other Appenders: AppenderDbi, AppenderDt, AppenderElasticSearch, AppenderGmail, AppenderSendmail, AppenderSyslog

Other Digest Appenders: AppenderDigest, AppenderMail, AppenderSendmail

Examples

if (requireNamespace("RPushbullet") && !is.null(getOption("rpushbullet.key")) ){
  app <- AppenderPushbullet$new()

  lg <- lgr::get_logger("test/dbi")$
    add_appender(app, "pb")$
    set_propagate(FALSE)

  lg$fatal("info")
  lg$fatal("test")

 invisible(lg$config(NULL))
}

lgrExtra documentation built on Jan. 6, 2023, 5:15 p.m.