0.0.1 • Published 1 year ago
jnlwlogger v0.0.1
Logger
Logger is a simple logging package for Node.js applications.
Installation
You can install the Logger package via npm:
npm install my-logger
Usage
To use the Logger package in your Node.js application, require it and instantiate a new Logger object:
const Logger = require('my-logger');
// Instantiate Logger with optional options
const logger = new Logger({ level: 'info' });
// Log messages
logger.info('This is an information message');
logger.warn('This is a warning message');
logger.error('This is an error message');
Options
The Logger constructor accepts an optional options
object with the following properties:
level
: Specifies the minimum log level to output. Possible values are'info'
,'warn'
, and'error'
. Default is'info'
.
API
Logger(options)
Creates a new Logger instance with the specified options.
options
(Object): Optional options object.
log(message, level)
Logs a message at the specified log level.
message
(String): The message to log.level
(String): Optional log level. Defaults to'info'
.
info(message)
Logs an information message.
message
(String): The message to log.
warn(message)
Logs a warning message.
message
(String): The message to log.
error(message)
Logs an error message.
message
(String): The message to log.
License
This project is licensed under the MIT License - see the LICENSE file for details.
0.0.1
1 year ago