winston-middleware 4.0.2 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of winston-middleware might be problematic. Click here for more details.

package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 4.0.3
2
+ * Update lodash to 4.17.15 ([#232](https://github.com/bithavoc/winston-middleware/pull/232))
3
+ * Add missing exceptionToMeta and skip to TypeScript definition ([#234](https://github.com/bithavoc/winston-middleware/pull/234))
4
+
5
+ ## 4.0.2
6
+ * Add blacklist fields to BaseErrorLoggerOptions interface ([#230](https://github.com/bithavoc/winston-middleware/pull/230))
7
+
1
8
  ## 4.0.1
2
9
  * Added `headerBlacklist` to BaseLoggerOptions for better typescript support ([#228](https://github.com/bithavoc/winston-middleware/pull/228))
3
10
 
package/Readme.md CHANGED
@@ -124,8 +124,8 @@ The logger needs to be added AFTER the express router(`app.router)`) and BEFORE
124
124
  baseMeta: Object, // default meta data to be added to log, this will be merged with the error data.
125
125
  meta: Boolean, // control whether you want to log the meta data about the request (default to true).
126
126
  metaField: String, // if defined, the meta data will be added in this field instead of the meta root object. Defaults to 'meta'. Set to `null` to store metadata at the root of the log entry.
127
- requestField: [String] // the property of the metadata to store the request under (default 'req'). Set to null to exclude request from metadata
128
- responseField: [String] // the property of the metadata to store the response under (default 'res'). If set to the same as 'requestField', filtered response and request properties will be merged. Set to null to exclude request from metadata
127
+ requestField: [String] // the property of the metadata to store the request under (default 'req'). Set to null to exclude request from metadata
128
+ responseField: [String] // the property of the metadata to store the response under (default 'res'). If set to the same as 'requestField', filtered response and request properties will be merged. Set to null to exclude request from metadata
129
129
  requestFilter: function (req, propName) { return req[propName]; } // A function to filter/return request values, defaults to returning all values allowed by whitelist. If the function returns undefined, the key/value will not be included in the meta.
130
130
  requestWhitelist: [String] // Array of request properties to log. Overrides global requestWhitelist for this instance
131
131
  headerBlacklist: [String], // Array of headers to omit from logs. Applied after any previous filters.
package/index.d.ts CHANGED
@@ -17,11 +17,13 @@ export interface FilterResponse extends Response {
17
17
  [other: string]: any;
18
18
  }
19
19
 
20
+ export type ExceptionToMetaFunction = (err: Error) => object;
20
21
  export type DynamicMetaFunction = (req: Request, res: Response, err: Error) => object;
21
22
  export type DynamicLevelFunction = (req: Request, res: Response, err: Error) => string;
22
23
  export type RequestFilter = (req: FilterRequest, propName: string) => any;
23
24
  export type ResponseFilter = (res: FilterResponse, propName: string) => any;
24
25
  export type RouteFilter = (req: Request, res: Response) => boolean;
26
+ export type ErrorRouteFilter = (req: Request, res: Response, err: Error) => boolean;
25
27
  export type MessageTemplate = string | ((req: Request, res: Response) => string);
26
28
 
27
29
  export interface BaseLoggerOptions {
@@ -68,16 +70,19 @@ export function logger(options: LoggerOptions): Handler;
68
70
  export interface BaseErrorLoggerOptions {
69
71
  baseMeta?: object;
70
72
  dynamicMeta?: DynamicMetaFunction;
73
+ exceptionToMeta?: ExceptionToMetaFunction;
71
74
  format?: Format;
72
75
  level?: string | DynamicLevelFunction;
73
76
  meta?: boolean;
74
77
  metaField?: string;
75
78
  requestField?: string;
79
+ responseField?: string;
76
80
  msg?: MessageTemplate;
77
81
  requestFilter?: RequestFilter;
78
82
  requestWhitelist?: string[];
79
83
  headerBlacklist?: string[];
80
84
  blacklistedMetaFields?: string[];
85
+ skip?: ErrorRouteFilter;
81
86
  }
82
87
 
83
88
  export interface ErrorLoggerOptionsWithTransports extends BaseErrorLoggerOptions {
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "middleware",
18
18
  "colors"
19
19
  ],
20
- "version": "4.0.2",
20
+ "version": "4.0.3",
21
21
  "repository": {
22
22
  "type": "git",
23
23
  "url": "https://github.com/bithavoc/winston-middleware.git"
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "chalk": "^2.4.1",
36
- "lodash": "^4.17.10"
36
+ "lodash": "^4.17.15"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/express": "^4.17.1",
@@ -91,4 +91,4 @@
91
91
  }
92
92
  ],
93
93
  "types": "index.d.ts"
94
- }
94
+ }