@livy/browser-console-handler

Writes Livy log records to a browser console

Usage no npm install needed!

<script type="module">
  import livyBrowserConsoleHandler from 'https://cdn.skypack.dev/@livy/browser-console-handler';
</script>

README

@livy/browser-console-handler

This Livy handler writes log records to a browser console with highlighting.


Synchronous logger support: yes

Runtime: Browsers


Basic Example

const { BrowserConsoleHandler } = require('@livy/browser-console-handler')

const handler = new BrowserConsoleHandler()

Installation

Install it via npm:

npm install @livy/browser-console-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

console

Type: Console

Default: the global console object

Description: The console object to use for logging

timestamps

Type: boolean

Default: false

Description: Whether to include timestamps in the output

useNativeDebug

Type: boolean

Default: false

Description: Whether to use the browser's built-in console.debug() for the "debug" level, which is only visible in the dev tools when explicitly configured so

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.

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.