Skip to content

logger — structured logging ​

Imported from the facade: import { logger } from "@/framework/facade.js".

Guide: Logger.

Signature ​

FunctionSignatureDescription
logger.trace(message, meta?) => voidFine-grained trace information
logger.debug(message, meta?) => voidDetailed debugging information
logger.info(message, meta?) => voidGeneral operational messages
logger.warn(message, meta?) => voidWarning conditions
logger.error(message, meta?) => voidError conditions (also logged to fatal.log)
logger.fatal(message, meta?) => voidCritical errors (exits process after logging)
logger.child(bindings) => CompatLoggerChild logger with added context

Use cases ​

ts
import { logger } from "@/framework/facade.js";

logger.info("Server started", { port: 3000 });
logger.error("Failed to connect", { error: err.message });

const child = logger.child({ module: "auth" });
child.info("User logged in", { userId: 42 });

Notes ​

  • Console output is colorized; error/fatal also write to fatal.log.
  • Handles uncaughtException and unhandledRejection globally (logged, and process-exit for exceptions).

Released under the MIT License.