TLDR - Typescript Logging Done Right
Introduction
TLDR is a logging library driven by and designed for TypeScript. It follows the design and functionality of logrus.
TLDR implements structured logging, which means that you can pass structured contexts into the library and evaluate them using a LMS lateron.
Usage Example
The example below is intended to be run in node, if you'd like to run it in the browser change NodeConsoleBackend
to BrowserConsoleBackend
.
import { NodeConsoleBackend, Logger } from '@deinstapel/tldr';
Logger.configureInstance({
globalContext: { session: Math.round(Math.random() * 10000000) },
backends: [new NodeConsoleBackend({
color: true,
formatting: 'human',
})],
});
Logger.withFields({
var: 'foo',
var2: 'bar',
answer: 42,
}).info('hello, world');
Logger.withField('answer', 42).log('customlevel', 'custom message')