Skip to main content

@boost/log

build status npm version

Lightweight level based logging system.

import { createLogger } from '@boost/log';

const log = createLogger();

log('Something has happened…');

Features

  • Isolated logger instances.
  • Supports 6 logging levels, in order of priority: log, trace, debug, info, warn, error.
  • Handles default and max logging levels.
  • Customizable transports with writable streams.
  • Toggleable logging at runtime.

Installation

yarn add @boost/log

Documentation

Index

Type Aliases

Formatter

Formatter: (item: LogItem) => string

LogLevel

LogLevel: debug | error | info | log | trace | warn

LogLevelLabels

LogLevelLabels: { [ L in LogLevel ]?: string }

LogMetadata

LogMetadata: Record<string, unknown>

Rotation

Rotation: daily | hourly | monthly | weekly

Variables

constDEFAULT_LABELS

DEFAULT_LABELS: LogLevelLabels = ...

constLOG_LEVELS

LOG_LEVELS: LogLevel[] = ...

constMAX_LOG_SIZE

MAX_LOG_SIZE: 10485760 = 10_485_760