micro-node-logger
v1.0.9
Published
A simple, lightweight logging utility for Node.js applications.
Downloads
2
Maintainers
Readme
Simple Node Logger
A simple, lightweight logging utility for Node.js applications, designed to be easy to integrate and use.
Features
- Simple API with three levels of logging: info, warn, and error.
- Color-coded output for better readability.
- Customizable log levels.
- Uses popular dependencies like
chalk
andmoment
for enhanced functionality.
Installation
To install Simple Node Logger, run the following command in your terminal:
npm install simple-node-logger
Usage
First, require the simple-node-logger
in your project:
const SimpleNodeLogger = require('simple-node-logger');
Then, create an instance of the logger:
const logger = new SimpleNodeLogger();
You can now use the logger in your application:
logger.info('This is an info message');
logger.warn('This is a warning message');
logger.error('This is an error message');
Setting Log Level
To set the log level, use the setLogLevel
method:
logger.setLogLevel('warn'); // Only warn and error messages will be logged
Dependencies
- chalk: For color-coding log messages.
- moment: For timestamping log messages.
- winston, pino: Optional advanced logging libraries.
- express: For future express-specific logging features.
Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue if you have any suggestions or feedback.
License
This project is licensed under the ISC License.