aurelia-logging-file
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.