@livy/uid-processor
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

@livy/uid-processor

This Livy processor adds a unique identifier to a log record's extra object. The identifier is not unique per-record but created with the UidProcessor instance.


Runtime: Node.js and browsers


Basic Example

const { createLogger } = require('@livy/logger')
const { UidProcessor } = require('@livy/uid-processor')

const logger = createLogger('app-logger', {
  processors: [new UidProcessor()]
})

Installation

Install it via npm:

npm install @livy/uid-processor

Options

The UidProcessor constructor takes the length of the unique identifier (in bytes, the actual identifier will be a hex string of double the length), defaulting to 7.

Public API

reset()

This processor implements the ResettableInterface. Resetting will generate a new identifier.

You usually don't want to call this method manually on an individual processor. Consider calling it on the logger instead.

uid

Get the generated unique identifier.

Package Sidebar

Install

npm i @livy/uid-processor

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

8.73 kB

Total Files

6

Last publish

Collaborators

  • loilo