osseus-logger

0.4.3 • Public • Published

JavaScript Style Guide

Osseus Logger

winston based osseus logger module

Install

$ npm install osseus-logger

Usage

Configuration

  • OSSEUS_LOGGER_LOG_LEVEL
    • Mandatory. See Winston Logging Levels
    • Default log levels:
      • DEV environment - silly
      • QA environment - debug
      • PROD envrionment - info
  • OSSEUS_LOGGER_NO_CONSOLE_OVERRIDE
    • Optional. Set to true if you wish to disable console override

Note: console override

  • console.debug ==> logger.debug
  • console.log ==> logger.debug
  • console.info ==> no override! can be used to bypass logger functionality
  • console.warn ==> logger.warn
  • console.error ==> logger.error

Example

First, create index.js:

const Osseus = require('osseus')

const main = async () => {
	try {
		// init osseus
		const osseus = await Osseus.init()
		// option #1
		osseus.logger.debug(`hello logger`)
		// option #2
		console.log(`hello logger`)
  	} catch (err) {
		console.error(err)
  	}
}

main()

Running:

$ node index.js --OSSEUS_LOGGER_LOG_LEVEL 'debug'

Will result in:

2018-06-21T12:38:15.650Z - debug: (Liors-MacBook-Pro.local) (63287) - hello logger
2018-06-21T12:38:15.650Z - debug: (Liors-MacBook-Pro.local) (63287) - hello logger

Contributing

Please see contributing guidelines.

License

Code released under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i osseus-logger

Weekly Downloads

3

Version

0.4.3

License

MIT

Unpacked Size

11.4 kB

Total Files

10

Last publish

Collaborators

  • liorrabin