mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 20:21:46 +00:00
Implement bunyan-format as both callable and newable (#40473)
* Updating type with tslint hint and tests to be verbose Signed-off-by: Ashley Abbott <ashpabb@gmail.com> * Redundant declare and required newlines Signed-off-by: Ashley Abbott <ashpabb@gmail.com>
This commit is contained in:
committed by
Sheetal Nandi
parent
fc04e45d78
commit
531f8b9c14
@@ -1,10 +1,31 @@
|
||||
import bunyan = require('bunyan');
|
||||
import BunyanFormatWritable = require('bunyan-format');
|
||||
import { Writable } from 'stream';
|
||||
|
||||
const formatOut: Writable = new BunyanFormatWritable({ outputMode: 'short' });
|
||||
|
||||
const logger1 = bunyan.createLogger({
|
||||
name: 'formatOut',
|
||||
stream: formatOut,
|
||||
});
|
||||
|
||||
const formatOut2: NodeJS.WritableStream = new BunyanFormatWritable({ outputMode: 'bunyan', levelInString: true });
|
||||
|
||||
const logger2 = bunyan.createLogger({
|
||||
name: 'formatOut2',
|
||||
stream: formatOut2,
|
||||
});
|
||||
|
||||
const formatOut3: Writable = BunyanFormatWritable({ outputMode: 'short' });
|
||||
|
||||
const logger3 = bunyan.createLogger({
|
||||
name: 'formatOut3',
|
||||
stream: formatOut3,
|
||||
});
|
||||
|
||||
const formatOut4: NodeJS.WritableStream = BunyanFormatWritable({ outputMode: 'bunyan', levelInString: true });
|
||||
|
||||
const logger4 = bunyan.createLogger({
|
||||
name: 'formatOut4',
|
||||
stream: formatOut4,
|
||||
});
|
||||
|
||||
Vendored
+8
-9
@@ -23,14 +23,13 @@ declare namespace BunyanFormatWritable {
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
interface BunyanFormatWritable extends Writable {}
|
||||
|
||||
declare var BunyanFormatWritable: {
|
||||
/** Creates a writable stream that formats bunyan records written to it. */
|
||||
(options: BunyanFormatWritable.Options, output?: Writable): BunyanFormatWritable;
|
||||
/** Creates a writable stream that formats bunyan records written to it. */
|
||||
/** Creates a writable stream that formats bunyan records written to it. */
|
||||
interface BunyanFormatWritable extends Writable {
|
||||
// tslint:disable-next-line no-misused-new
|
||||
new (options: BunyanFormatWritable.Options, output?: Writable): BunyanFormatWritable;
|
||||
};
|
||||
(options: BunyanFormatWritable.Options, output?: Writable): BunyanFormatWritable;
|
||||
}
|
||||
|
||||
export = BunyanFormatWritable;
|
||||
declare const BunyanFormat: BunyanFormatWritable;
|
||||
|
||||
export = BunyanFormat;
|
||||
|
||||
Reference in New Issue
Block a user