{"id":16981,"library":"eazy-logger","title":"eazy-logger","description":"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.","status":"maintenance","version":"4.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/shakyshane/easy-logger","tags":["javascript","plugins"],"install":[{"cmd":"npm install eazy-logger","lang":"bash","label":"npm"},{"cmd":"yarn add eazy-logger","lang":"bash","label":"yarn"},{"cmd":"pnpm add eazy-logger","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides color and styling capabilities for log output.","package":"tfunk","optional":false}],"imports":[{"note":"This package is CommonJS-only and does not support ES module `import` syntax. The Logger class is accessed as a property of the main module export.","wrong":"import { Logger } from 'eazy-logger';","symbol":"Logger","correct":"const { Logger } = require('eazy-logger');"},{"note":"The primary way to instantiate a logger is by calling the `Logger` factory method directly on the `require('eazy-logger')` return value.","wrong":"import logger from 'eazy-logger';","symbol":"logger","correct":"const logger = require('eazy-logger').Logger({ /* config */ });"},{"note":"For CommonJS, the entire module can be `require`d, and the `Logger` factory method is then accessed as a property of the imported object.","wrong":"import * as eazyLogger from 'eazy-logger';","symbol":"eazyLogger","correct":"const eazyLogger = require('eazy-logger');\nconst logger = eazyLogger.Logger({ /* config */ });"}],"quickstart":{"code":"const { Logger } = require('eazy-logger');\n\nconst logger = Logger({\n    prefix: \"{blue:[}{magenta:easy-logger}{blue:] }\",\n    useLevelPrefixes: true\n});\n\nconsole.log('--- Standard Loggers ---');\nlogger.debug(\"Debugging Msg\");\nlogger.info(\"Info statement\");\nlogger.warn(\"A little warning with string %s\", \"substitution\");\nlogger.error(\"An error occurred in file: {red:%s}\", \"/users/awesomedev/file.js\");\n\nconsole.log('\\n--- String Substitution + Colours ---');\nlogger.log(\"error\", \"Use {green:built-in} %s\", \"String substitution\");\n\nconsole.log('\\n--- Set Option for Next Log Only ---');\nlogger.setOnce(\"useLevelPrefixes\", false).warn(\"This warning will not have a level prefix.\");\nlogger.info(\"This info statement will use prefixes again.\");","lang":"javascript","description":"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."},"warnings":[{"fix":"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.","message":"The package is CommonJS-only and will not work directly with ES module `import` syntax in modern Node.js environments unless transpiled or dynamically imported. Attempting to `import` it will result in a runtime error.","severity":"breaking","affected_versions":"All versions"},{"fix":"Evaluate the long-term viability for new projects. For existing projects, be aware that future breaking Node.js changes might not be addressed.","message":"The project is in 'inactive' maintenance mode, meaning new features are unlikely, and compatibility with future Node.js versions or emerging JavaScript standards (like native TypeScript support) may not be guaranteed. While a security fix was applied recently, ongoing proactive maintenance is limited.","severity":"gotcha","affected_versions":">=4.1.0"},{"fix":"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 }; }`","message":"There are no official TypeScript type definitions shipped with the package, nor are there community-maintained types on `@types/eazy-logger`. This leads to type errors when used in TypeScript projects.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"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;`.","cause":"Attempting to use `require()` in a JavaScript file that Node.js treats as an ES module (e.g., due to `\"type\": \"module\"` in `package.json` or a `.mjs` file extension).","error":"ReferenceError: require is not defined in ES module scope"},{"fix":"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.","cause":"This error occurs in TypeScript when the `eazy-logger` package is imported without type definitions, and TypeScript cannot infer the structure of the module export.","error":"Property 'Logger' does not exist on type 'typeof import(\"/path/to/node_modules/eazy-logger/index\")'."}],"ecosystem":"npm","meta_description":null}