A lightweight, flexible logging library for Node.js applications. This library provides an intuitive API for managing log levels, formatting logs, and writing logs to files. It includes a Singleton-based Logger class with out-of-the-box support for logging info, warn, error, and verbose levels.
Future updates will introduce a CLI for easier configuration and use.
Related pages:
info, warn, error, verb (verbose).To install the package, use npm:
npm install file-error-logging
import Logger from "file-error-logging/dist/cjs";
// Configure the logger
Logger.setConfig({
development: false,
rotation: "monthly",
});
// Log messages with different levels
Logger.log("info", "This is an info message", {
includeTimestampInConsole: true,
logToFile: false,
color: "whiteBright",
});
Logger.log("warn", "This is a warning message", {
includeTimestampInConsole: false
});
Logger.log("verb", "This is a verbose message");
Logger.log("error", new Error("This is an error message"));