Merge pull request #19925 from pasieronen/bunyan-bugsnag

bunyan-bugsnag: add types
This commit is contained in:
Benjamin Lichtman
2017-09-22 10:05:37 -07:00
committed by GitHub
4 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import * as bunyanBugsnag from 'bunyan-bugsnag';
import * as bunyan from 'bunyan';
const stream1 = bunyanBugsnag();
const stream2 = bunyanBugsnag({
systemInfo: ['name', 'hostname', 'pid', 'req_id', 'level', 'time', 'v'],
warningLevel: 'warn',
errorLevel: 'error',
});
const options: bunyanBugsnag.Options = {
systemInfo: ['name', 'hostname', 'pid', 'req_id', 'level', 'time', 'v'],
warningLevel: 30,
errorLevel: 20
};
const stream3 = bunyanBugsnag(options);
const logger = bunyan.createLogger({
name: 'appName',
streams: [{
type: 'raw',
level: 'warn',
stream: stream3
}]
});

18
types/bunyan-bugsnag/index.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
// Type definitions for bunyan-bugsnag 1.0
// Project: https://github.com/marnusw/bunyan-bugsnag
// Definitions by: Pasi Eronen <https://github.com/pasieronen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Logger from 'bunyan';
declare namespace bugsnagLogStream {
interface Options {
systemInfo?: string[];
warningLevel?: Logger.LogLevel;
errorLevel?: Logger.LogLevel;
}
}
declare function bugsnagLogStream(options?: bugsnagLogStream.Options): NodeJS.WritableStream;
export = bugsnagLogStream;

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bunyan-bugsnag-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }