mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add format property to logger options (#35924)
* Add format property to logger options * Add tests for format property
This commit is contained in:
parent
257fb84ce2
commit
dfa678e143
@ -1,6 +1,7 @@
|
||||
import expressWinston = require('express-winston');
|
||||
import * as winston from 'winston';
|
||||
import express = require('express');
|
||||
import { Format } from 'logform';
|
||||
|
||||
const app = express();
|
||||
|
||||
@ -12,6 +13,7 @@ app.use(expressWinston.logger({
|
||||
colorize: true,
|
||||
dynamicMeta: (req, res, err) => ({ foo: 'bar' }),
|
||||
expressFormat: true,
|
||||
format: new Format(),
|
||||
ignoreRoute: (req, res) => true,
|
||||
ignoredRoutes: ['foo'],
|
||||
level: (req, res) => 'level',
|
||||
@ -45,6 +47,7 @@ app.use(expressWinston.logger({
|
||||
app.use(expressWinston.errorLogger({
|
||||
baseMeta: { foo: 'foo', nested: { bar: 'baz' } },
|
||||
dynamicMeta: (req, res, err) => ({ foo: 'bar' }),
|
||||
format: new Format(),
|
||||
level: (req, res) => 'level',
|
||||
metaField: 'metaField',
|
||||
msg: 'msg',
|
||||
|
||||
3
types/express-winston/index.d.ts
vendored
3
types/express-winston/index.d.ts
vendored
@ -5,6 +5,7 @@
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { ErrorRequestHandler, Handler, Request, Response } from 'express';
|
||||
import { Format } from 'logform';
|
||||
import * as winston from 'winston';
|
||||
import * as Transport from 'winston-transport';
|
||||
|
||||
@ -30,6 +31,7 @@ export interface BaseLoggerOptions {
|
||||
colorize?: boolean;
|
||||
dynamicMeta?: DynamicMetaFunction;
|
||||
expressFormat?: boolean;
|
||||
format?: Format;
|
||||
ignoreRoute?: RouteFilter;
|
||||
ignoredRoutes?: string[];
|
||||
level?: string | DynamicLevelFunction;
|
||||
@ -63,6 +65,7 @@ export function logger(options: LoggerOptions): Handler;
|
||||
export interface BaseErrorLoggerOptions {
|
||||
baseMeta?: object;
|
||||
dynamicMeta?: DynamicMetaFunction;
|
||||
format?: Format;
|
||||
level?: string | DynamicLevelFunction;
|
||||
metaField?: string;
|
||||
msg?: MessageTemplate;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user