@mont3ch/logger
v1.1.2
Published
logger library
Downloads
6
Readme
logger
This library it will help us to have a logger with emojis it use internally winston and node-emojis
Usage
Simple Logger
const { loggerFactory } = require('@mont3ch/logger');
const logger = loggerFactory({ appName: 'My-app', defaultEmojis: { error: 'rocket' }, enableDebug: true});
logger.info('hola mundo');
logger.error('falló algo');
logger.warn(`advertencia algo dejo de funcionar :coffee: :hugging_face: :rocket: algo salio mal`);
logger.debug('este es un debug');
HTTP-LOGGER
const { httpLogger: httpLoggerFactory, loggerFactory } = require('@mont3ch/logger');
const logger = loggerFactory({ appName: 'My-app', defaultEmojis: { error: 'rocket' }, enableDebug: true});
const express = require('express');
const app = express();
// you could use loggerFactory to create your own logger object.
const httpLogger = httpLoggerFactory(logger);
app.use(httpLogger);
What is inside
You can find a loggerFactory
that you'll use in order to create a winston logger instance.
Also you can find a httpLogger
that is a middleware you could use to log every request you receive in http using express.