jozzby-logger
v1.6.5
Published
A simple yet clean logger for express applications
Downloads
3
Maintainers
Readme
Http Logging + Formatted console logging
A simple logger middleware for ExpressJS yet very powerfull. With this module you can add a http logger like morgan, but also you can import the functions: info()
, error()
and warn()
in your project for better console logging.
Usage
# Install the module
npm install jozzby-logger
Import the module
const logger = require('jozzby-logger'); // OR use imports
import { httpLog, info, error, warn } from 'jozzby-logger';
Use the http logger
const app = express();
app.use(httpLog());
Formatted console logging
// Namespace defaults to DEFAULT
info('Message', 'NAMESPACE');
warn('Message', 'NAMESPACE');
error('Message', 'NAMESPACE');
/**
* [22-01-2022 16:19:38] [INFO] [NAMESPACE] Message
* [22-01-2022 16:19:38] [WARN] [NAMESPACE] Message
* [22-01-2022 16:19:38] [ERROR] [NAMESPACE] Message
*/