inbuilt-actions: Predefined(sample) handler actions

Description Usage Arguments Details Examples

Description

When you define a handler, you specify its name and the associated action. A few predefined actions described below are provided.

Usage

1
2
3
writeToConsole(msg, handler, ...)

writeToFile(msg, handler, ...)

Arguments

msg

A formatted message to handle.

handler

The handler environment containing its options. You can register the same action to handlers with different properties.

...

parameters provided by logger system to interact with the action.

Details

A handler action is a function that accepts a formatted message and handler configuration.

Messages passed are filtered already regarding loglevel.

... parameters are used by logging system to interact with the action. ... can contain dry key to inform action that it meant to initialize itself. In the case action should return TRUE if initialization succeeded.

If it's not a dry run ... contain the whole preformatted logging.record. A logging.record is a named list and has following structure:

msg

contains the real formatted message

level

message level as numeric

levelname

message level name

logger

name of the logger that generated it

timestamp

formatted message timestamp

writeToConsole detects if crayon package is available and uses it to color messages. The coloring can be switched off by means of configuring the handler with color_output option set to FALSE.

writeToFile action expects file path to write to under file key in handler options.

Examples

1
2
3
## define your own function and register it with a handler.
## author is planning a sentry client function.  please send
## any interesting function you may have written!

periscope documentation built on July 8, 2020, 7:18 p.m.