@orveth/logger
v0.1.1
Published
Structured logging interfaces and a JSON-lines console sink.
Maintainers
Readme
@orveth/logger
Package name
@orveth/logger
Purpose
Defines a structured logging interface and provides a JSON-line console implementation.
Installation
pnpm add @orveth/loggerBasic usage
import { ConsoleLogger } from "@orveth/logger";
const logger = new ConsoleLogger("info", { service: "api" });
logger.info("listening", { port: 3000 });
logger.error("request failed", { route: "/health" }, err);API overview
Exports:
Loggerinterface (trace..fatal,child,level)- Supporting types:
LogLevel,LogAttributes,LogRecord ConsoleLoggerimplementation writing JSON lines toprocess.stdout
Design notes
- Log filtering is based on minimum configured level.
child()merges contextual attributes for subsequent log calls.
Error behavior
ConsoleLogger does not throw for logging calls; serialization uses JSON.stringify and may throw if attributes contain unsupported values (avoid circular structures).
TypeScript notes
This package ships .d.ts declarations and is authored in TypeScript strict mode.
License
Released under the MIT License. See the repository LICENSE file.
