@livy/array-handler
v1.0.4
Published
Stores Livy log records in an array
Downloads
7
Maintainers
Readme
@livy/array-handler
This Livy handler stores all log records it receives in an array which can then be read. This is mostly useful for debugging.
Synchronous logger support: yes
Runtime: Node.js and browsers
Basic Example
const { ArrayHandler } = require('@livy/array-handler')
const handler = new ArrayHandler()
// ...use handler in a logger...
// Print all records the handler received
console.log(handler.records)
Installation
Install it via npm:
npm install @livy/array-handler
Options
An object of options can be passed to the handler constructor as the first argument.
The following options are available:
bubble
Type: boolean
Default: true
Description: Controls whether records handled by this handler should bubble up to other handlers.
See also: Bubbling
level
Type: LogLevel
Default: 'debug'
Description: Controls which log records should be handled based on their log level.
Public API
bubble
Controls whether records handled by this handler should bubble up to other handlers. Initially set through the bubble
option.
See also: Bubbling
level
The minimum log level of a log record to be considered by this handler. Initially set through the level
option.
records
(read-only)
The records
property exposes all log records stored inside the ArrayHandler
.
processors
This handler supports processors by implementing the ProcessableHandlerInterface
.
reset()
This handler implements the ResettableInterface
. Resetting it clears its records and resets all attached processors.
You usually don't want to call this method manually on an individual handler. Consider calling it on the logger instead.