1.0.5 • Published 3 years ago

@strong-roots-capital/ratlog-debug v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

ratlog-debug

License NPM Package Build status

Ratlog logger using debug opt-in interface

Install

npm install @strong-roots-capital/ratlog-debug

Use

In this example, the following snippets are written to a file index.ts.

Create loggers with desired tags

import { ratlogDebug } from '@strong-roots-capital/ratlog-debug'

const debug = {
  request: log.tag('request'),
  response: log.tag('response'),
} as const

By default, logs with tags will not be printed during program execution

debug.request('Making a request')
debug.response(Received a response')
$ npx ts-node index.ts

No program output

Enable output for a tagged log stream

$ DEBUG=request npx ts-node index.ts
[request] Making a request

Or multiple streams

$ DEBUG=request,response npx ts-node index.ts
[request] Making a request
[response] Received a response

Note that regular expressions are supported in the DEBUG environment variable.

Acknowledgments

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago