| AppenderMemory {lgr} | R Documentation |
Abstract class for logging to memory buffers
Description
NOTE: This is an abstract class. Abstract classes cannot be instantiated directly, but are exported for package developers that want to extend lgr - for example by creating their own Appenders or Layouts. Please refer to the see also section for actual implementations of this class.
AppenderMemory is extended by Appenders that retain an in-memory event
buffer, such as AppenderBuffer and AppenderPushbullet from the
lgrExtra package.
Super classes
lgr::Filterable -> lgr::Appender -> AppenderMemory
Active bindings
flush_on_exitA
logicalscalar. Should the buffer be flushed if the Appender is destroyed (e.g. because the R session is terminated)?flush_on_rotateA
logicalscalar. Should the buffer be flushed when it is rotated because$buffer_sizeis exceeded?should_flushA
functionwith exactly one arguments:event.$append()calls this function internally on the current LogEvent and flushes the buffer if it evaluates toTRUE.buffer_sizeintegerscalar>= 0. Maximum number of LogEvents to buffer.flush_thresholdA
numericorcharacterthreshold. LogEvents with a log_level equal to or lower than this threshold trigger flushing the buffer.buffer_eventsA
listof LogEvents. Contents of the buffer.buffer_eventsA
data.frame. Contents of the buffer converted to adata.frame.buffer_eventsA
data.frame. Contents of the buffer converted to adata.table.
Methods
Public methods
Inherited methods
Method new()
Usage
AppenderMemory$new(...)
Method append()
Usage
AppenderMemory$append(event)
Method flush()
Sends the buffer's contents to all attached Appenders and then clears the Buffer
Usage
AppenderMemory$flush()
Method clear()
Clears the buffer, discarding all buffered Events
Usage
AppenderMemory$clear()
Method set_buffer_size()
Set the maximum size of the buffer
Usage
AppenderMemory$set_buffer_size(x)
Arguments
xan
integerscalar>= 0. Number of LogEvents to buffer.
Method set_should_flush()
Set function that can trigger flushing the buffer
Usage
AppenderMemory$set_should_flush(x)
Arguments
xA
functionwith the single argumentevent. SettingxtoNULLis a shortcut forfunction(event) FALSE. See active bindings.
Method set_flush_on_exit()
Should the buffer be flushed when the Appender is destroyed?
Usage
AppenderMemory$set_flush_on_exit(x)
Arguments
xA
logicalscalar. See active bindings.
Method set_flush_on_rotate()
Should the buffer be flushed if buffer_size is exceeded?
Usage
AppenderMemory$set_flush_on_rotate(x)
Arguments
xA
logicalscalar. See active bindings.
Method set_flush_threshold()
Set threshold that triggers flushing
Usage
AppenderMemory$set_flush_threshold(level)
Arguments
levelA
numericorcharacterthreshold. See active bindings.
Method show()
Display the contents of the log table. Relies on the
$format_event method of the Layout attached to this Appender.
Usage
AppenderMemory$show(threshold = NA_integer_, n = 20L)
Arguments
thresholdcharacterorintegerscalar. The minimum log level that should be displayed.nintegerscalar. Show only the lastnlog entries that matchthreshold.
Method format()
Usage
AppenderMemory$format(color = FALSE, ...)
See Also
Other abstract classes:
AppenderTable,
Appender,
Filterable