improved-logging
TypeScript icon, indicating that this package has built-in type declarations

2.1.10 • Public • Published

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'

// .log file will be created
logging.setLogPath(path.join(__dirname, '../', 'logs'))

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

logging.setSeparateLogsByDate(true)

logging.info('This log will be located in MONTH_YYYY/DD.log')

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')

/improved-logging/

    Package Sidebar

    Install

    npm i improved-logging

    Weekly Downloads

    7

    Version

    2.1.10

    License

    MIT

    Unpacked Size

    23.7 kB

    Total Files

    6

    Last publish

    Collaborators

    • andreyha