JSPM

  • Created
  • Published
  • Downloads 1202624
  • Score
    100M100P100Q187840F
  • License MIT

Expressive TypeScript Logger for Node.js. Shows call locations, pretty prints objects and Errors. JSON output and transports.

Package Exports

  • tslog

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tslog) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

📝 tslog: Brand new expressive TypeScript Logger for Node.js

lang: Typescript License: MIT npm version Dependency status CI: Travis code style: prettier GitHub stars

Powerful, fast and expressive logging for Node.js

tslog pretty output

Highlights

  • Small footprint, blazing performance
  • Fully typed with TypeScript support (correct location in *.ts files)
  • Log levels
  • Custom pluggable loggers
  • Structured or JSON output
  • Beauty object and error interpolation (incl. stack trace)
  • Stack trace through native V8 API
  • Code path linked to position in IDE
  • Works for both: TypeScript and JavaScript
  • Optionally catch all console logs
  • well documented
  • 100% test coverage

Example

import { Logger } from "tslog";

const log: Logger = new Logger();
log.silly("I am a silly log.");

Install

npm install tslog

Enable TypeScript source map support

This features enables tslog to reference to the correct line numbers in your TypeScript source code.

// tsconfig.json
{
    // ...
    "compilerOptions": {
        // ...
        "sourceMap": true
    }
}

Usage

import { Logger } from "tslog";

const log: Logger = new Logger({ name: "myLogger" });
log.silly("I am a silly log.");
log.debug("I am a debug log.");
log.info("I am an info log.");
log.warn("I am a warn log with a json object:", jsonObj);
log.error("I am an error log.");
log.fatal(new Error("I am a pretty Error with a stacktrace."));

TSDoc