1.0.5 • Published 3 years ago
starless-logger v1.0.5
Starless Logger
A simple logging library for Node.js.
Installation
You can install the package via npm:
npm install starless-loggerUsage
Import the package and call the log function with a message and an optional log level:
const { log } = require("starless-logger");
log("Hello, world!"); // logs "[timestamp] [INFO] Hello, world!" in green
log("Warning message", "warn"); // logs "[timestamp] [WARN] Warning message" in yellow
log("Error message", "error"); // logs "[timestamp] [ERROR] Error message" in redThe log function takes two arguments: message (string) and level (optional string). If level is not provided, the default value is "info". Valid values for level are "info", "warn", and "error".
Examples
const { log } = require("starless-logger");
log("Starting server...", "info");
log("Connection lost!", "warn");
log("Failed to authenticate user", "error");