mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 03:02:04 +08:00
[express-winston] Adding support for express-winston v3
The interface to Winston has changed (Winston now has a Logger type).
This commit is contained in:
@@ -34,9 +34,11 @@ app.use(expressWinston.logger({
|
||||
],
|
||||
}));
|
||||
|
||||
const logger = winston.createLogger();
|
||||
|
||||
// Logger with minimum options (winstonInstance)
|
||||
app.use(expressWinston.logger({
|
||||
winstonInstance: winston,
|
||||
winstonInstance: logger,
|
||||
}));
|
||||
|
||||
// Error Logger with all options
|
||||
@@ -62,7 +64,7 @@ app.use(expressWinston.errorLogger({
|
||||
|
||||
// Error Logger with min options (winstonInstance)
|
||||
app.use(expressWinston.errorLogger({
|
||||
winstonInstance: winston,
|
||||
winstonInstance: logger,
|
||||
}));
|
||||
|
||||
expressWinston.bodyBlacklist.push('potato');
|
||||
|
||||
6
types/express-winston/index.d.ts
vendored
6
types/express-winston/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for express-winston 2.4
|
||||
// Type definitions for express-winston 3.0
|
||||
// Project: https://github.com/bithavoc/express-winston#readme
|
||||
// Definitions by: Alex Brick <https://github.com/bricka>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -44,7 +44,7 @@ export interface LoggerOptionsWithTransports extends BaseLoggerOptions {
|
||||
}
|
||||
|
||||
export interface LoggerOptionsWithWinstonInstance extends BaseLoggerOptions {
|
||||
winstonInstance: typeof winston;
|
||||
winstonInstance: winston.Logger;
|
||||
}
|
||||
|
||||
export type LoggerOptions = LoggerOptionsWithTransports | LoggerOptionsWithWinstonInstance;
|
||||
@@ -66,7 +66,7 @@ export interface ErrorLoggerOptionsWithTransports extends BaseErrorLoggerOptions
|
||||
}
|
||||
|
||||
export interface ErrorLoggerOptionsWithWinstonInstance extends BaseErrorLoggerOptions {
|
||||
winstonInstance: typeof winston;
|
||||
winstonInstance: winston.Logger;
|
||||
}
|
||||
|
||||
export type ErrorLoggerOptions = ErrorLoggerOptionsWithTransports | ErrorLoggerOptionsWithWinstonInstance;
|
||||
|
||||
Reference in New Issue
Block a user