1.3.9 • Published 5 years ago

standard-log-memory v1.3.9

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

standard-log-memory

NPM version NPM downloads

Circle CI Travis CI Codecov Coveralls Status

Provides a memory log reporter for standard-log

Usage

import { createMemoryLogReporter, logEntriesToString } from 'standard-log-memory'
import { config, getLogger } from 'standard-log'

const reporter = createMemoryLogReporter()
config({ reporters: [reporter]})

const log = getLogger('some logger')
log.info('some log')

console.info(reporter.logs) // contains all log entries
console.info(logEntriesToString(reporter.logs)) // render log entries as string using `plainFormatter`

You can supply a formatter to pre-process the log entries before they are saved. For example, you can use it to censor sensitive information.

import { createMemoryLogReporter } from 'standard-log-memory'

const reporter = createMemoryLogReporter({
  formatter: (entry) => ({
    ...entry,
    args: entry.args(removeSensitiveInformation)
  })
})

function removeSensitiveInformation(values: any[]) {
  return /* your implementation */
}
1.3.9

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago