Skip to main content

Installation

Requirements: Node.js 18+

Basic usage

Client configuration

The TypeScript SDK currently operates in server mode only. Start a plog serve instance and point the client at it.

Logging events

Labels and context

Default labels

Labels passed to the constructor are merged into every event. Event-level labels override defaults for matching keys.

Label context

setContext() attaches business data to a label value for dashboard enrichment — for example, attaching a borrower name and loan amount to a loan_id.
The label key must exist in the client’s default labels — otherwise an Error is thrown. The data is sent as a fire-and-forget PUT /v1/context/{key}/{value} request. Transport errors are logged with console.warn and never throw. You can also push context at construction time with the context option (fire-and-forget, promises are not awaited):

Lifecycle