UNPKG

nostr-websocket-utils

Version:

Robust WebSocket utilities for Nostr applications with automatic reconnection, supporting both ESM and CommonJS. Features channel-based messaging, heartbeat monitoring, message queueing, and comprehensive error handling with type-safe handlers.

35 lines 867 B
/** * @file Logger utility * @module utils/logger */ import pino from 'pino'; /** * Create a new logger instance * @param name Name of the logger * @returns Logger instance */ export function createLogger(name) { return pino({ name, level: process.env.LOG_LEVEL || 'info', timestamp: pino.stdTimeFunctions.isoTime }); } /** * Get a logger instance for a specific component * @param component Component name for the logger * @returns Logger instance */ export function getLogger(component) { return createLogger(component); } /** * Get a child logger instance * @param parent Parent logger instance * @param bindings Additional bindings for the child logger * @returns Child logger instance */ export function getChildLogger(parent, bindings) { return parent.child(bindings); } //# sourceMappingURL=logger.js.map