1.0.2 • Published 5 years ago

aurelia-logging-file v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

aurelia-logging-file

NPM version NPM downloads Build status Coverage Status

File based appenders for aurelia-logging and @unional/logging.

Usage

import { addAppender } from 'aurelia-logging' // or `@unional/logging`
import { FileAppender } from 'aurelia-logging-file'

// All logs are appended to the same file.
const file = new FileAppender('filename.log')
addAppender(file)

// log away...

You can change the format of your messages:

import { stringifyLogLevel } from 'aurelia-logging-file'

new FileAppender('filename.log', { format: '{id}({LEVEL}): {messages}}' })
new FileAppender('filename.log', {
  format: (id, level, messages) => `${id}(${stringifyLogLevel(level)}): ${messages}`
})
  • {ID} will print logger id in upper case.
  • {LEVEL} will print log level in upper case.