@homitagdev/loggerdev

An ES6 class for writing logs to DB. Currently posgres alone supported


Keywords
logger, log-to-postgres
License
GPL-3.0
Install
npm install @homitagdev/loggerdev@1.1.0

Documentation

Logger

Logger helps you to write your logs in to DB. Right now it supports postgress DB alone.

Log levels are defined as follows:

Log Levels

INFO DEBUG WARNING ERROR TRACE FATAL

Example usage

Const Logger = require('Logger') let logger = new Logger('ModuleName')

logger.log('INFO', 'Login successful')

Example 2

Logger.debug('DB connection acquired')

Example 3

Logger.error(Error)

Note that you can pass the Error object or @homitag/httpstatuserror object itself to logger meessage parameter, as the Logger understand it and recognizes error messages and other respective information and writes them in to DB.