mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-26 00:21:41 +08:00
Merge pull request #19925 from pasieronen/bunyan-bugsnag
bunyan-bugsnag: add types
This commit is contained in:
27
types/bunyan-bugsnag/bunyan-bugsnag-tests.ts
Normal file
27
types/bunyan-bugsnag/bunyan-bugsnag-tests.ts
Normal 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
18
types/bunyan-bugsnag/index.d.ts
vendored
Normal 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;
|
||||
22
types/bunyan-bugsnag/tsconfig.json
Normal file
22
types/bunyan-bugsnag/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/bunyan-bugsnag/tslint.json
Normal file
1
types/bunyan-bugsnag/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user