This package has been deprecated

Author message:

this is absorbed into 'standard-log' directly.

standard-log-memory
TypeScript icon, indicating that this package has built-in type declarations

1.3.9 • Public • Published

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 */
}

Readme

Keywords

none

Package Sidebar

Install

npm i standard-log-memory

Weekly Downloads

2

Version

1.3.9

License

MIT

Unpacked Size

16 kB

Total Files

30

Last publish

Collaborators

  • unional