@livy/http-handler
v1.0.4
Published
Sends Livy log records to an HTTP endpoint
Downloads
101
Maintainers
Readme
@livy/http-handler
This Livy handler sends log records to an HTTP endpoint using got
.
Synchronous logger support: no
Runtime: Node.js
Basic Example
const { HttpHandler } = require('@livy/http-handler')
const handler = new HttpHandler('https://example.com/logs')
Installation
Install it via npm:
npm install @livy/http-handler
Options
The first argument to this handler's constructor determines where to send logs.
It is either
the URL endpoint (as a string):
new HttpHandler('https://example.com')
a
got
options object:new HttpHandler({ url: 'https://example.com/logs', method: 'post' })
a callback creating one of the above from a log record (or an array of log records when batch-handling and
allowBatchRequests
is enabled):new HttpHandler(record => `https://example.com/logs/${record.channel}`)
An object of options can be passed to the constructor as the second argument.
The following options are available:
allowBatchRequests
Type: boolean
Default: false
Description: Whether batch handling should send all pending records as an array in one request
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.
requestOptions
Type: object | (record: LogRecord | LogRecord[]) => object
Default: false
Description: got
options to use. May be the bare options object or a callback creating that object from a log record (or an array of log records when batch-handling and allowBatchRequests
is enabled).
sequential
Type: boolean
Default: false
Description: Whether HTTP requests in batch handling must be executed sequentially instead of in parallel. This has no effect if allowBatchRequests
is enabled.
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.
processors
This handler supports processors by implementing the ProcessableHandlerInterface
.
reset()
This handler implements the ResettableInterface
. Resetting it 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.