Learn R Programming

futile.logger (version 1.2.1)

addLayout: Manage layouts within the 'futile.logger' sub-system

Description

Provides functions for managing layouts. Typically only addLayout is used when manually creating a logging configuration.

Usage

getLayout(name)
## S3 method for class 'default':
addLayout(name, ...)
## S3 method for class 'character':
addLayout(name, fun, ...)

Arguments

name
The name of the layout or the layout itself. If the layout function is passed as the name, the symbol will be used as the name
fun
The layout function, which must be passed explicitly if the name of the layout is different from the layout function's symbol
...
Further arguments to pass to the layout function when it is activated

Value

  • 'getLayout' returns a layout function, which is wrapped in a parent function to enforce a consistent calling API.

Details

Layouts are responsible for formatting messages so they are human-readable. Like an appender, a layout must first be registered in the system using 'addLayout' prior to referencing it in a logger configuration. Once the layout is registered, it can be referenced in any logger definition.

The 'getLayout' function is used internally to get the registered layout function. It is kept visible so user-level introspection is available.

'simpleLayout' is a pre-defined layout function that prints messages in the following format: LEVEL [timestamp] Message.

'formatLayout' is a pre-defined layout function that prints tokens based on a format string. This is currently not implemented.

Examples

Run this code
addLayout('default', simpleLayout)
  addLayout(simpleLayout)

Run the code above in your browser using DataLab