eazy-logger

4.1.0 · maintenance · verified Wed Apr 22

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.

Common errors

Warnings

Install

Imports

Quickstart

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.

const { Logger } = require('eazy-logger');

const logger = Logger({
    prefix: "{blue:[}{magenta:easy-logger}{blue:] }",
    useLevelPrefixes: true
});

console.log('--- Standard Loggers ---');
logger.debug("Debugging Msg");
logger.info("Info statement");
logger.warn("A little warning with string %s", "substitution");
logger.error("An error occurred in file: {red:%s}", "/users/awesomedev/file.js");

console.log('\n--- String Substitution + Colours ---');
logger.log("error", "Use {green:built-in} %s", "String substitution");

console.log('\n--- Set Option for Next Log Only ---');
logger.setOnce("useLevelPrefixes", false).warn("This warning will not have a level prefix.");
logger.info("This info statement will use prefixes again.");

view raw JSON →