@strong-roots-capital/ratlog-debug
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

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

Weekly Downloads

1

Version

1.0.5

License

ISC

Unpacked Size

7.21 kB

Total Files

7

Last publish

Collaborators

  • hamroctopus
  • amchelle