@companieshouse/structured-logging-node 1.0.4 → 1.0.5

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.
@@ -7,5 +7,6 @@ interface LogMetaData {
7
7
  event?: string;
8
8
  status?: number;
9
9
  duration?: number;
10
+ context?: string;
10
11
  }
11
12
  export = LogMetaData;
@@ -2,6 +2,6 @@
2
2
  import { RequestHandler } from "express";
3
3
  import StructuredLogger from "./StructuredLogger";
4
4
  declare class MiddlewareFactory {
5
- static create(logger: StructuredLogger): RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs>;
5
+ static create(logger: StructuredLogger): RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
6
6
  }
7
7
  export = MiddlewareFactory;
@@ -12,6 +12,7 @@ class HumanFormatFactory {
12
12
  created: moment_1.default().format("YYYY-MM-DDTHH:mm:ss.SSSZ"),
13
13
  namespace: namespace,
14
14
  event: info.level,
15
+ context: info.context,
15
16
  path: info.path,
16
17
  method: info.method,
17
18
  status: info.status,
@@ -1 +1 @@
1
- {"version":3,"file":"HumanFormatFactory.js","sourceRoot":"","sources":["../../src/formatting/HumanFormatFactory.ts"],"names":[],"mappings":";;;;AACA,oDAA4B;AAC5B,sDAA8B;AAE9B,MAAM,kBAAkB;IAEb,MAAM,CAAC,MAAM,CAAC,SAAiB;QAElC,MAAM,SAAS,GAAG,iBAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAE5C,OAAO,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI;YAEvC,MAAM,WAAW,GAAgB;gBAC7B,OAAO,EAAE,gBAAM,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC;gBACpD,SAAS,EAAE,SAAS;gBACpB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC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AAE,IAAI,CAAC,MAAM;gBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aAC1B,CAAC;YAEF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC;YAE7C,IAAI,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,IAAI,WAAW,CAAC,KAAK,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YAE7G,IAAI,CAAC,OAAO,CAAC,UAAU,GAAG;gBACtB,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;oBAChC,OAAO,IAAI,UAAU,GAAG,KAAK,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;iBACnD;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,iBAAS,kBAAkB,CAAC"}
@@ -13,6 +13,7 @@ class JsonFormatFactory {
13
13
  namespace: namespace,
14
14
  data: {
15
15
  message: info.message,
16
+ context: info.context,
16
17
  path: info.path,
17
18
  method: info.method,
18
19
  status: info.status,
@@ -1 +1 @@
1
- {"version":3,"file":"JsonFormatFactory.js","sourceRoot":"","sources":["../../src/formatting/JsonFormatFactory.ts"],"names":[],"mappings":";;;;AAAA,oDAA4B;AAC5B,sDAA8B;AAE9B,MAAM,iBAAiB;IAEZ,MAAM,CAAC,MAAM,CAAC,SAAiB;QAElC,OAAO,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI;YAEvC,MAAM,OAAO,GAAG;gBACZ,OAAO,EAAE,gBAAM,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC;gBACpD,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,SAAS,EAAE,SAAS;gBACpB,IAAI,EAAE;oBACF,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBAC1B;aACJ,CAAC;YAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,iBAAS,iBAAiB,CAAC"}
1
+ {"version":3,"file":"JsonFormatFactory.js","sourceRoot":"","sources":["../../src/formatting/JsonFormatFactory.ts"],"names":[],"mappings":";;;;AAAA,oDAA4B;AAC5B,sDAA8B;AAE9B,MAAM,iBAAiB;IAEZ,MAAM,CAAC,MAAM,CAAC,SAAiB;QAElC,OAAO,iBAAO,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI;YAEvC,MAAM,OAAO,GAAG;gBACZ,OAAO,EAAE,gBAAM,EAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC;gBACpD,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,SAAS,EAAE,SAAS;gBACpB,IAAI,EAAE;oBACF,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBAC1B;aACJ,CAAC;YAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,iBAAS,iBAAiB,CAAC"}
@@ -2,7 +2,8 @@
2
2
  const getRequestMetaData = function (request) {
3
3
  return {
4
4
  path: request.path,
5
- method: request.method
5
+ method: request.method,
6
+ context: request.headers['context'] === undefined ? undefined : request.headers['context'].toString()
6
7
  };
7
8
  };
8
9
  module.exports = getRequestMetaData;
@@ -1 +1 @@
1
- {"version":3,"file":"getRequestMetaData.js","sourceRoot":"","sources":["../src/getRequestMetaData.ts"],"names":[],"mappings":";AAGA,MAAM,kBAAkB,GAAG,UAAU,OAAgB;IAEjD,OAAO;QACH,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;KACzB,CAAC;AACN,CAAC,CAAC;AAEF,iBAAS,kBAAkB,CAAC"}
1
+ {"version":3,"file":"getRequestMetaData.js","sourceRoot":"","sources":["../src/getRequestMetaData.ts"],"names":[],"mappings":";AAGA,MAAM,kBAAkB,GAAG,UAAU,OAAgB;IAEjD,OAAO;QACH,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;KACxG,CAAC;AACN,CAAC,CAAC;AAEF,iBAAS,kBAAkB,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="qs" />
2
2
  /// <reference types="express" />
3
3
  import ApplicationLogger from "./ApplicationLogger";
4
- declare const createLoggerMiddleware: (namespace: string) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs>;
4
+ declare const createLoggerMiddleware: (namespace: string) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
5
5
  declare const createLogger: (namespace: string) => ApplicationLogger;
6
6
  export { createLoggerMiddleware, createLogger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companieshouse/structured-logging-node",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "A logging solution for CHS structured logging in node apps.",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -29,15 +29,15 @@
29
29
  "@types/mocha": "~8.0.3",
30
30
  "@types/on-finished": "~2.3.1",
31
31
  "@types/proxyquire": "~1.3.28",
32
- "@typescript-eslint/eslint-plugin": "~4.3.0",
33
- "@typescript-eslint/parser": "~4.3.0",
32
+ "@typescript-eslint/eslint-plugin": "~4.22.1",
33
+ "@typescript-eslint/parser": "~4.22.1",
34
34
  "chai": "~4.2.0",
35
- "eslint": "~7.10.0",
35
+ "eslint": "~7.25.0",
36
36
  "eslint-plugin-chai-friendly": "~0.6.0",
37
- "mocha": "~8.1.3",
37
+ "mocha": "~8.3.2",
38
38
  "mockdate": "~3.0.2",
39
39
  "proxyquire": "~2.1.3",
40
- "ts-node": "~9.0.0",
40
+ "ts-node": "~9.1.1",
41
41
  "typescript": "~4.0.3"
42
42
  },
43
43
  "files": [