@t8n/logger
v1.0.0
Published
Structured developer logging utility for TitanPL using native logging API
Downloads
9
Readme
@t8n/logger
A lightweight, developer-friendly logging extension for TitanPL. Built on top of the native Titan logging API.
Features
- Full Color Output: The entire log message is colored based on its level.
- No Prefixes: Clean output without redundant text labels (e.g.,
[INFO]). - One-stop Configuration: Easily configure both log level and colors via a single
configure()method. - Fast & Efficient: Internally delegates to
t.log, ensuring zero overhead. - Type Definitions: Ready for TypeScript developers.
Installation
npm install @t8n/loggerUsage
import { logger } from "@t8n/logger";
// Standard logging (Entire line is colored)
logger.info("Server initialized");
logger.success("User successfully registered");
logger.warn("Potential cache overflow detected");
logger.error("Failed to connect to secondary database");
logger.debug("Request payload", { id: 101, type: "sync" });Configuration
logger.configure(options)
Use configure() to adjust the behavior and appearance of the logger.
logger.configure({
level: "debug",
colors: {
info: "\x1b[36m", // Cyan
success: "\x1b[35m", // Magenta
warn: "\x1b[33m", // Yellow
error: "\x1b[31m", // Red
debug: "\x1b[37m" // White
}
});Options:
level: Sets the minimum log level to display.debug: Everything is shown.info: (Default) Info, success, warnings, and errors are shown.warn: Warnings and errors are shown.error: Only errors are shown.
colors: Overrides the default ANSI colors for specific log levels.
License
ISC
