Osseus Logger
winston based osseus logger module
Install
$ npm install @colucom/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
- DEV environment -
-
OSSEUS_LOGGER_NO_CONSOLE_OVERRIDE
- Optional. Set to true if you wish to disable
console
override
- Optional. Set to true if you wish to disable
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.