Skip to content

JakeGinnivan/typescript-log

 
 

Repository files navigation

TypeScript abstract logger

Useful for libraries which want to enable the consuming application to provide a logger. Our projects ended up duplicating the same logging interface and consoleLogger and noopLogger's.

Compatible with universal applications (works in browser and node)

Usage

import pino from 'pino'
import { consoleLogger, noopLogger, Logger } from 'typescript-log'

const pinoLogger: Logger = pino({})

const logsNothingLogger: Logger = noopLogger()
const logsToConsoleLogger: Logger = consoleLogger(
    /* optional, warn default */ 'error'
)

References

Similar to https://github.com/kallaspriit/ts-log but uses log(obj, msg) format for the interface

About

Logger interface with a few simple implementations, interface compatible with pino, bunyan and probably others

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 97.9%
  • JavaScript 2.1%