A lightweight and developer-friendly logging library for Node.js and TypeScript applications. It provides simple, readable log methods that make debugging, monitoring, and tracking application behavior easier. Distinguish the logs by tags and particular colors.
If you encounter any issues or have feature requests, you can:
- Visit Nishidh Singh: https://xnishidh.space
- Open an issue in this repository
Contributions, bug reports, and feedback are always welcome.
npm install @nishidhx/loggeryarn add @nishidhx/loggerbun add @nishidhx/loggerChanged the timing from ISO string to formatted time.
Import the logger into your project:
import { logger } from "@nishidhx/logger";| Method | Description |
|---|---|
logger.I() |
Log informational messages. |
logger.D() |
Log debug messages for development and troubleshooting. |
logger.W() |
Log warning messages for non-critical issues. |
logger.E() |
Log error messages when something goes wrong. |
logger.I("This is an info log");logger.D("This is a debug log");logger.W("This is a warning log");logger.E("This is an error log");[I] This is an info log
[D] This is a debug log
[W] This is a warning log
[E] This is an error log
By default the library formats timestamps in format.ts using the local time for the clock and an ISO-style date for the day. Concretely the current implementation builds a string like:
[2026-07-03 10:23:45 AM]:[INFO]: Your message here
Registering the transport with a Logger (you can create a new Logger instance or pass transports into the exported singleton):
import { ConsoleTransport, FileTransport, Logger } from "@nishidhx/logger";
const customLogger = new Logger({
transports: [
new ConsoleTransport(),
new FileTransport({
filename: "_app.log",
timeStampedFilename: true,
path: "logs"
})
]
})
customLogger.I("Hello")filename: you can change the filename as per your choice.timeStampedFilename: set to true if u wants the logs files gets created based on the time logging started.path: set your own custom path from the saving of logs.append: setting it to true will append all the logs in one file.
Run unit tests or local validation (if applicable):
npm testIf you'd like, I can add a small example transport file and a test showing registration and output.
MIT © Nishidh Singh
