项目作者: sevenwestmedia-labs

项目描述 :
Logger interface with a few simple implementations, interface compatible with pino, bunyan and probably others
高级语言: TypeScript
项目地址: git://github.com/sevenwestmedia-labs/typescript-log.git
创建时间: 2018-12-28T04:08:33Z
项目社区:https://github.com/sevenwestmedia-labs/typescript-log

开源协议:MIT License

下载


TypeScript abstract logger


CI
Release

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

  1. import pino from 'pino'
  2. import { consoleLogger, noopLogger, Logger } from 'typescript-log'
  3. const pinoLogger: Logger = pino({})
  4. const logsNothingLogger: Logger = noopLogger()
  5. const logsToConsoleLogger: Logger = consoleLogger(
  6. /* optional, warn default */ 'error',
  7. )

References

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