DefinitelyTyped/types/bunyan-config/bunyan-config-tests.ts
2017-03-24 14:27:52 -07:00

40 lines
1008 B
TypeScript

import * as bunyan from "bunyan";
import bunyanConfig = require("bunyan-config");
var jsonConfig = {
name: "myLogger",
streams: [{
stream: "stdout"
}, {
stream: { name: "stderr" }
}, {
type: "raw",
stream: {
name: "bunyan-logstash",
params: {
host: "localhost",
port: 5005
}
}
}, {
type: "raw",
stream: {
name: "bunyan-redis",
params: {
host: "localhost",
port: 6379
}
}
}], serializers: {
req: "bunyan:stdSerializers.req",
fromNodeModules: "someNodeModule",
fromNodeModulesWithProps: "someNodeModule:a.b.c",
custom: "./lib/customSerializers:custom",
another: "./lib/anotherSerializer",
absolutePath: "/path/to/serializer:xyz"
}
};
var config = bunyanConfig(jsonConfig);
var logger = require("bunyan").createLogger(bunyanConfig);