sc_logger
v1.0.5
Published
Simple logger system
Downloads
2
Readme
SC_Logger (Simple Console Logger) for Node.js
This lightweight Node.js logging module uses ANSI escape sequences to provide colored and formatted output in the console. It supports different log levels (WARN, ERROR, DEBUG, INFO) and allows you to easily customize the appearance of log messages.
| Function | Description | | ---------------------------------------------- | -------------------------------------------------- | | logWarn(message, ...args) | Displays a warning message in the console. | | logError(message, ...args) | Displays an error message in the console. | | logDebug(message, ...args) | Displays a debug message in the console. | | logInfo(message, ...args) | Displays an informative message in the console. |
Usage
Installation:
Install the module using npm:
npm install my-logger
Use:
import { logDebug, logError, logInfo, logWarn } from "sc_logger" logWarn("This is a warning message") logError("This is an error message") logDebug("This is a debug message") logInfo("This is an informative message")
This is a simple way to log message using the logger, also u can pass parameters to the logger.
- Use - Passing params:
import { logDebug, logError, logInfo, logWarn } from "sc_logger" logWarn("This is a warning message {}, {}", arg1, arg2) logError("This is an error {} - message", arg) logDebug("This is {} a {} debug {} message", [arg1, arg2, arg3] ) logInfo("This is an informative message")
ANSI Colors Used
- WARN: Yellow (\u001B[33m).
- ERROR: Red (\u001B[31m).
- DEBUG: Green (\u001B[32m).
- INFO: Gray (\u001B[90m).