@companieshouse/structured-logging-node 2.0.5 → 2.0.7
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.
package/lib/LoggerFactory.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -39,21 +49,21 @@ class LoggerFactory {
|
|
|
39
49
|
static createTransportOptions(namespace) {
|
|
40
50
|
return {
|
|
41
51
|
handleExceptions: true,
|
|
42
|
-
format: config_1.default.humanReadable
|
|
43
|
-
HumanFormatFactory_1.default.create(namespace)
|
|
44
|
-
JsonFormatFactory_1.default.create(namespace)
|
|
52
|
+
format: config_1.default.humanReadable
|
|
53
|
+
? HumanFormatFactory_1.default.create(namespace)
|
|
54
|
+
: JsonFormatFactory_1.default.create(namespace)
|
|
45
55
|
};
|
|
46
56
|
}
|
|
47
57
|
static create(options) {
|
|
48
58
|
winston_1.default.addColors(levelConfig_1.default.colours);
|
|
49
59
|
if (config_1.default.otelLogEnabled) {
|
|
60
|
+
const resource = (0, resources_1.detectResources)({
|
|
61
|
+
detectors: [resources_1.envDetector, resources_1.processDetector, resources_1.hostDetector]
|
|
62
|
+
});
|
|
50
63
|
const loggerProvider = new sdk_logs_1.LoggerProvider({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
detectors: [resources_1.envDetector, resources_1.processDetector, resources_1.hostDetector]
|
|
54
|
-
})
|
|
64
|
+
resource,
|
|
65
|
+
processors: [new sdk_logs_1.BatchLogRecordProcessor(new exporter_logs_otlp_http_1.OTLPLogExporter())]
|
|
55
66
|
});
|
|
56
|
-
loggerProvider.addLogRecordProcessor(new sdk_logs_1.BatchLogRecordProcessor(new exporter_logs_otlp_http_1.OTLPLogExporter()));
|
|
57
67
|
api.logs.setGlobalLoggerProvider(loggerProvider);
|
|
58
68
|
}
|
|
59
69
|
const transports = [
|
|
@@ -63,7 +73,7 @@ class LoggerFactory {
|
|
|
63
73
|
return winston_1.default.createLogger({
|
|
64
74
|
level: config_1.default.level,
|
|
65
75
|
levels: levelConfig_1.default.levels,
|
|
66
|
-
transports
|
|
76
|
+
transports,
|
|
67
77
|
exitOnError: false
|
|
68
78
|
});
|
|
69
79
|
}
|
package/lib/LoggerFactory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoggerFactory.js","sourceRoot":"","sources":["../src/LoggerFactory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LoggerFactory.js","sourceRoot":"","sources":["../src/LoggerFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA+C;AAC/C,sDAAkF;AAClF,w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AC,MAAM;YACxB,UAAU;YACV,WAAW,EAAE,KAAK;SACrB,CAAqB,CAAC;IAC3B,CAAC;CACJ;AAED,iBAAS,aAAa,CAAC"}
|
|
@@ -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,kFAAkF;YAClF,MAAM,WAAW,GAAgB;gBAC7B,OAAO,EAAE,IAAA,gBAAM,GAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC;gBACpD,SAAS,EAAE,SAAS;gBACpB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,OAAO,EAAE,IAAI,CAAC,
|
|
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,kFAAkF;YAClF,MAAM,WAAW,GAAgB;gBAC7B,OAAO,EAAE,IAAA,gBAAM,GAAE,CAAC,MAAM,CAAC,0BAA0B,CAAC;gBACpD,SAAS,EAAE,SAAS;gBACpB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,OAAO,EAAE,IAAI,CAAC,OAAiB;gBAC/B,IAAI,EAAE,IAAI,CAAC,IAAc;gBACzB,MAAM,EAAE,IAAI,CAAC,MAAgB;gBAC7B,MAAM,EAAE,IAAI,CAAC,MAAgB;gBAC7B,QAAQ,EAAE,IAAI,CAAC,QAAkB;gBACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,WAAW,EAAE,IAAI,CAAC,WAAW;aAChC,CAAC;YAEF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;YAEvG,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,CAAC;oBACjC,OAAO,IAAI,UAAU,GAAG,KAAK,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpD,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,iBAAS,kBAAkB,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
/// <reference types="express" />
|
|
3
1
|
import ApplicationLogger from "./ApplicationLogger";
|
|
4
2
|
declare const createLoggerMiddleware: (namespace: string) => import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
5
3
|
declare const createLogger: (namespace: string) => ApplicationLogger;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@companieshouse/structured-logging-node",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
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",
|
|
@@ -23,37 +23,34 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@opentelemetry/api": "^1.9.0",
|
|
26
|
-
"@opentelemetry/
|
|
27
|
-
"@opentelemetry/
|
|
28
|
-
"@opentelemetry/
|
|
29
|
-
"@opentelemetry/
|
|
26
|
+
"@opentelemetry/core": "^2.2.0",
|
|
27
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.208.0",
|
|
28
|
+
"@opentelemetry/resources": "^2.2.0",
|
|
29
|
+
"@opentelemetry/sdk-logs": "^0.208.0",
|
|
30
|
+
"@opentelemetry/sdk-node": "^0.208.0",
|
|
31
|
+
"@opentelemetry/winston-transport": "^0.19.0",
|
|
30
32
|
"moment": "^2.29.4",
|
|
31
33
|
"on-finished": "~2.3.0",
|
|
32
|
-
"winston": "
|
|
34
|
+
"winston": "3.18.3"
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
|
35
37
|
"@types/chai": "~4.2.22",
|
|
36
|
-
"@types/express": "~4.17.
|
|
38
|
+
"@types/express": "~4.17.21",
|
|
37
39
|
"@types/mocha": "~10.0.6",
|
|
38
40
|
"@types/on-finished": "~2.3.1",
|
|
39
41
|
"@types/sinon": "^17.0.4",
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
41
|
-
"@typescript-eslint/parser": "^
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^8.50.1",
|
|
43
|
+
"@typescript-eslint/parser": "^8.50.1",
|
|
42
44
|
"chai": "~4.2.0",
|
|
43
|
-
"eslint": "^8.
|
|
44
|
-
"eslint-
|
|
45
|
-
"eslint-plugin-chai-friendly": "~0.6.0",
|
|
46
|
-
"eslint-plugin-import": "2.27.5",
|
|
47
|
-
"eslint-plugin-node": "11.1.0",
|
|
48
|
-
"eslint-plugin-promise": "6.0.0",
|
|
49
|
-
"eslint-plugin-standard": "5.0.0",
|
|
45
|
+
"eslint": "^8.52.0",
|
|
46
|
+
"eslint-plugin-chai-friendly": "^1.1.0",
|
|
50
47
|
"mocha": "^11.7.2",
|
|
51
48
|
"mockdate": "~3.0.2",
|
|
52
49
|
"nyc": "^17.1.0",
|
|
53
50
|
"sinon": "^21.0.0",
|
|
54
|
-
"sonarqube-scanner": "^3.0
|
|
55
|
-
"ts-node": "^10.
|
|
56
|
-
"typescript": "^
|
|
51
|
+
"sonarqube-scanner": "^3.1.0",
|
|
52
|
+
"ts-node": "^10.9.2",
|
|
53
|
+
"typescript": "^5.2.2"
|
|
57
54
|
},
|
|
58
55
|
"files": [
|
|
59
56
|
"lib/**/*"
|