improved-logging

Easy to use logging


Keywords
node, log, logging, console, colored console, chalk
License
MIT
Install
npm install improved-logging@3.4.0

Documentation

Node.js module for logging into console, file and browser (see below for more info)

Installation

Node package manager

npm i improved-logging

YARN

yarn add improved-logging

Usage:

import logging from 'improved-logging'

logging.info('This is logging example')

Log types

import logging from 'improved-logging'

logging.info('Some information')
logging.important('Some important information')
logging.success('Something is done')
logging.warn('Warning')
logging.error('Something went wrong')
logging.fatal('Critical error')

Enable logging into the files

import logging from 'improved-logging'

logging.setLogfileName(path.join(__dirname, '../', 'logs', 'main.log'))

logging.info('Now will log all to file')

See the logs from the browser

Could be helpful when the machine is blocked during automatization process

How to enable browser logging

import logging from 'improved-logging'

logging.startServer()
logging.info('Now you can see logs on http://localhost:3000')

How to turn different logs on/off

import logging from 'improved-logging'

logging.verbose('You will see this in console')

logging.setLogLevel('info')

logging.verbose('This one is hidden')


logging.setLogLevel('important')

logging.important('Now info, success and verbose logs are hidden')
logging.info('You will not see this in console/log file/browser')