eazy-logger is a lightweight command-line interface (CLI) logging utility designed for Node.js environments. It provides basic logging levels (debug, info, warn, error) and supports `printf`-style string substitution for dynamic message formatting. A key feature is its integration with `tfunk` for customizable, colorful console output, allowing developers to define prefixes and style messages with various colors. The current stable version is 4.1.0, released over a year ago. The project is in maintenance mode, with minimal activity primarily focused on critical fixes rather than new feature development, as indicated by its 'Inactive' status on Snyk. Its primary differentiators are its simplicity and built-in support for styled terminal output without external color libraries.
npm install eazy-loggerVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing the logger with a custom prefix and level prefixes, then using various log levels, string substitution, and setting options for a single log statement.
Ensure your project is configured for CommonJS, or use `const { Logger } = require('eazy-logger');` within an ES module via dynamic `await import('eazy-logger')` if applicable. For new projects, consider a modern logger with native ESM support.Evaluate the long-term viability for new projects. For existing projects, be aware that future breaking Node.js changes might not be addressed.
Create a custom declaration file (e.g., `eazy-logger.d.ts`) to provide type information for the `Logger` class and its methods. An example would be `declare module 'eazy-logger' { class Logger { constructor(options: any); debug(...args: any[]): void; info(...args: any[]): void; warn(...args: any[]): void; error(...args: any[]): void; log(level: string, ...args: any[]): void; setOnce(key: string, value: any): Logger; } export { Logger }; }`Either convert your project to CommonJS (remove `"type": "module"`), rename the file to `.cjs`, or use dynamic import with `const eazyLogger = await import('eazy-logger'); const { Logger } = eazyLogger;`.Create a `eazy-logger.d.ts` declaration file in your project to define the module's structure and the `Logger` class. See the 'Warnings' section for a basic example.