Skip to content
This repository has been archived by the owner on Dec 27, 2018. It is now read-only.

v0.4.1 - Exports Logger

Compare
Choose a tag to compare
@emmenko emmenko released this 20 Feb 13:01
· 34 commits to master since this release

Exports Logger and extend configuration ecf0528

You can now use the Logger in another component and just extend it with the configuration you need

# your logger class
{Logger} = require 'sphere-node-connect'

module.exports = class extends Logger
  @appName: 'my-new-app'

  @levelStream: 'warn'

  @levelFile: 'error'

  @path: '/var/log/my-app.log'


# implementation
logger = require './logger'

@logger = logger.init
  streams: [
    type: 'rotating-file'
    path: '/var/log/foo.log'
    period: '1d', # daily rotation
    count: 3 # keep 3 back copies
  ]

@logger.error 'Oops, something went wrong'