mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
- extend bunyan in the export instead of augmenting it globally - add tests from the project's README
26 lines
554 B
TypeScript
26 lines
554 B
TypeScript
import * as bunyan from "browser-bunyan";
|
|
|
|
const log = bunyan.createLogger({
|
|
name: 'myLogger',
|
|
streams: [
|
|
{
|
|
level: 'info',
|
|
stream: new bunyan.ConsoleFormattedStream()
|
|
}
|
|
],
|
|
serializers: bunyan.stdSerializers,
|
|
src: true
|
|
});
|
|
|
|
log.info('hi on info');
|
|
|
|
const log2 = bunyan.createLogger({
|
|
name: 'myLogger',
|
|
stream: new bunyan.ConsoleRawStream()
|
|
});
|
|
|
|
const myObject = { x: 1, y: 2 };
|
|
log.info({ obj: myObject }, 'This is my object:');
|
|
|
|
new bunyan.ConsoleFormattedStream({ logByLevel: true });
|