@axinom/mosaic-service-common 0.38.0 → 0.40.0-rc.0
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/dist/common/config/basic-config-definitions.d.ts +7 -2
- package/dist/common/config/basic-config-definitions.d.ts.map +1 -1
- package/dist/common/config/basic-config-definitions.js +3 -0
- package/dist/common/config/basic-config-definitions.js.map +1 -1
- package/dist/common/logging/index.d.ts +1 -0
- package/dist/common/logging/index.d.ts.map +1 -1
- package/dist/common/logging/index.js +1 -0
- package/dist/common/logging/index.js.map +1 -1
- package/dist/common/logging/log-formatter.d.ts +15 -0
- package/dist/common/logging/log-formatter.d.ts.map +1 -0
- package/dist/common/logging/log-formatter.js +68 -0
- package/dist/common/logging/log-formatter.js.map +1 -0
- package/dist/common/logging/logger.d.ts +38 -14
- package/dist/common/logging/logger.d.ts.map +1 -1
- package/dist/common/logging/logger.js +43 -24
- package/dist/common/logging/logger.js.map +1 -1
- package/package.json +2 -3
- package/src/common/config/basic-config-definitions.spec.ts +1 -0
- package/src/common/config/basic-config-definitions.ts +3 -0
- package/src/common/logging/index.ts +1 -0
- package/src/common/logging/log-formatter.spec.ts +111 -0
- package/src/common/logging/log-formatter.ts +88 -0
- package/src/common/logging/logger.spec.ts +49 -1
- package/src/common/logging/logger.ts +53 -27
|
@@ -12,6 +12,7 @@ import { Dict } from '../types';
|
|
|
12
12
|
* healthEndpointPort // e.g. HEALTH_ENDPOINT_PORT=9000
|
|
13
13
|
* secureLoggingMode // e.g. SECURE_LOGGING_MODE=UNSAFE_SECRETS_NOT_HIDDEN_UNSAFE
|
|
14
14
|
* logMaskKeywords // e.g. LOG_MASK_KEYWORDS=secret,password,connectionString
|
|
15
|
+
* fullDevLogs // e.g. FULL_DEV_LOGS=true
|
|
15
16
|
* isDev // true for NODE_ENV=development
|
|
16
17
|
* isProd // true for NODE_ENV=production
|
|
17
18
|
* ```
|
|
@@ -22,13 +23,15 @@ export declare const getBasicConfigDefinitions: (variables?: Dict<string | undef
|
|
|
22
23
|
/** @example SERVICE_ID=my-business-service */
|
|
23
24
|
serviceId: () => string;
|
|
24
25
|
/** @example LOG_LEVEL=INFO */
|
|
25
|
-
logLevel: () => "" | "
|
|
26
|
+
logLevel: () => "" | "ERROR" | "FATAL" | "WARN" | "INFO" | "DEBUG" | "TRACE";
|
|
26
27
|
/** @example HEALTH_ENDPOINT_PORT=9000 */
|
|
27
28
|
healthEndpointPort: () => number;
|
|
28
29
|
/** @example SECURE_LOGGING_MODE=UNSAFE_DEBUG_UNSAFE */
|
|
29
30
|
secureLoggingMode: () => MaskMode;
|
|
30
31
|
/** @example LOG_MASK_KEYWORDS=secret,password,connectionString */
|
|
31
32
|
logMaskKeywords: () => string[];
|
|
33
|
+
/** @example FULL_DEV_LOGS=true */
|
|
34
|
+
fullDevLogs: () => boolean;
|
|
32
35
|
/** @example NODE_ENV=development */
|
|
33
36
|
isDev: () => boolean;
|
|
34
37
|
/** @example NODE_ENV=production */
|
|
@@ -248,13 +251,15 @@ declare const config: import("./config-validation").ValueObject<{
|
|
|
248
251
|
/** @example SERVICE_ID=my-business-service */
|
|
249
252
|
serviceId: () => string;
|
|
250
253
|
/** @example LOG_LEVEL=INFO */
|
|
251
|
-
logLevel: () => "" | "
|
|
254
|
+
logLevel: () => "" | "ERROR" | "FATAL" | "WARN" | "INFO" | "DEBUG" | "TRACE";
|
|
252
255
|
/** @example HEALTH_ENDPOINT_PORT=9000 */
|
|
253
256
|
healthEndpointPort: () => number;
|
|
254
257
|
/** @example SECURE_LOGGING_MODE=UNSAFE_DEBUG_UNSAFE */
|
|
255
258
|
secureLoggingMode: () => MaskMode;
|
|
256
259
|
/** @example LOG_MASK_KEYWORDS=secret,password,connectionString */
|
|
257
260
|
logMaskKeywords: () => string[];
|
|
261
|
+
/** @example FULL_DEV_LOGS=true */
|
|
262
|
+
fullDevLogs: () => boolean;
|
|
258
263
|
/** @example NODE_ENV=development */
|
|
259
264
|
isDev: () => boolean;
|
|
260
265
|
/** @example NODE_ENV=production */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-config-definitions.d.ts","sourceRoot":"","sources":["../../../src/common/config/basic-config-definitions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAuB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAsBhC
|
|
1
|
+
{"version":3,"file":"basic-config-definitions.d.ts","sourceRoot":"","sources":["../../../src/common/config/basic-config-definitions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAuB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAsBhC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,yBAAyB,eACzB,KAAK,MAAM,GAAG,SAAS,CAAC,WAC1B,QAAQ;IAIf,oCAAoC;;IAMpC,8CAA8C;;IAE9C,8BAA8B;;IAE9B,yCAAyC;;IAGzC,uDAAuD;;IAWvD,kEAAkE;;IAGlE,kCAAkC;;IAElC,oCAAoC;;IAIpC,mCAAmC;;CAKtC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,sCAAsC,eACtC,KAAK,MAAM,GAAG,SAAS,CAAC,WAC1B,QAAQ;IAIf,8CAA8C;;IAG9C,0DAA0D;;IAG1D,8DAA8D;;CAIjE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kCAAkC,eAClC,KAAK,MAAM,GAAG,SAAS,CAAC,WAC1B,QAAQ;IAIf,0CAA0C;;CAI7C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,gCAAgC,gBAC9B,MAAM,cACR,KAAK,MAAM,GAAG,SAAS,CAAC,WAC1B,QAAQ;IAIf,yBAAyB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4C;;IAG5C,0CAA0C;;IAG1C,wCAAwC;;IAMxC,4CAA4C;;IAE5C,yDAAyD;;IAEzD,wCAAwC;;EAyIwB,CAAC;AACrE,MAAM,MAAM,cAAc,GAAG,OAAO,SAAS,CAAC;AAE9C;;GAEG;AACH,QAAA,MAAM,oBAAoB;IArFtB,yEAAyE;;IAGzE,8EAA8E;;IAG9E,sEAAsE;;IAGtE,wDAAwD;;IAExD,oEAAoE;;IAGpE,iEAAiE;;EAuES,CAAC;AAC/E,MAAM,MAAM,yBAAyB,GAAG,OAAO,oBAAoB,CAAC;AAEpE;;GAEG;AACH,QAAA,MAAM,yBAAyB;IA9H3B,8DAA8D;;IAE9D,mEAAmE;;IAEnE,yEAAyE;;IAGzE,8EAA8E;;IAG9E,sEAAsE;;EAsHzE,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG,OAAO,yBAAyB,CAAC;AAE9E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,QAAO,MAuCrC,CAAC"}
|
|
@@ -33,6 +33,7 @@ const env_var_extensions_1 = require("./env-var-extensions");
|
|
|
33
33
|
* healthEndpointPort // e.g. HEALTH_ENDPOINT_PORT=9000
|
|
34
34
|
* secureLoggingMode // e.g. SECURE_LOGGING_MODE=UNSAFE_SECRETS_NOT_HIDDEN_UNSAFE
|
|
35
35
|
* logMaskKeywords // e.g. LOG_MASK_KEYWORDS=secret,password,connectionString
|
|
36
|
+
* fullDevLogs // e.g. FULL_DEV_LOGS=true
|
|
36
37
|
* isDev // true for NODE_ENV=development
|
|
37
38
|
* isProd // true for NODE_ENV=production
|
|
38
39
|
* ```
|
|
@@ -64,6 +65,8 @@ const getBasicConfigDefinitions = (variables = process.env, logger) => {
|
|
|
64
65
|
},
|
|
65
66
|
/** @example LOG_MASK_KEYWORDS=secret,password,connectionString */
|
|
66
67
|
logMaskKeywords: () => env.get('LOG_MASK_KEYWORDS').default(logging_1.defaultMaskKeywords).asArray(),
|
|
68
|
+
/** @example FULL_DEV_LOGS=true */
|
|
69
|
+
fullDevLogs: () => env.get('FULL_DEV_LOGS').default('false').asBool(),
|
|
67
70
|
/** @example NODE_ENV=development */
|
|
68
71
|
isDev: function () {
|
|
69
72
|
return this.environment() === 'development';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-config-definitions.js","sourceRoot":"","sources":["../../../src/common/config/basic-config-definitions.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,sEAAsE;AACtE,qCAAyC;AACzC,2BAAyB;AACzB,wCAAuC;AACvC,wCAA2D;AAE3D,2DAI6B;AAC7B,6DAAkE;AAElE,qFAAqF;AACrF,6EAA6E;AAC7E,EAAE;AACF,8BAA8B;AAC9B,4CAA4C;AAC5C,0FAA0F;AAC1F,uCAAuC;AACvC,mEAAmE;AACnE,oCAAoC;AACpC,4EAA4E;AAC5E,uHAAuH;AACvH,wFAAwF;AACxF,mCAAmC;AAEnC;;;;;;;;;;;;;;GAcG;AACI,MAAM,yBAAyB,GAAG,CACvC,YAAsC,OAAO,CAAC,GAAG,EACjD,MAAiB,EACjB,EAAE;IACF,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,SAAS,EAAE,EAAE,UAAU,EAAV,+BAAU,EAAE,EAAE,MAAM,CAAC,CAAC;IACpD,OAAO;QACL,oCAAoC;QACpC,WAAW,EAAE,GAAG,EAAE,CAChB,GAAG;aACA,GAAG,CAAC,UAAU,CAAC;aACf,QAAQ,EAAE;aACV,MAAM,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QAClD,8CAA8C;QAC9C,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC5D,8BAA8B;QAC9B,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,UAAU,EA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,CAAC;IAEpE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAvCW,QAAA,kBAAkB,sBAuC7B"}
|
|
1
|
+
{"version":3,"file":"basic-config-definitions.js","sourceRoot":"","sources":["../../../src/common/config/basic-config-definitions.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,sEAAsE;AACtE,qCAAyC;AACzC,2BAAyB;AACzB,wCAAuC;AACvC,wCAA2D;AAE3D,2DAI6B;AAC7B,6DAAkE;AAElE,qFAAqF;AACrF,6EAA6E;AAC7E,EAAE;AACF,8BAA8B;AAC9B,4CAA4C;AAC5C,0FAA0F;AAC1F,uCAAuC;AACvC,mEAAmE;AACnE,oCAAoC;AACpC,4EAA4E;AAC5E,uHAAuH;AACvH,wFAAwF;AACxF,mCAAmC;AAEnC;;;;;;;;;;;;;;;GAeG;AACI,MAAM,yBAAyB,GAAG,CACvC,YAAsC,OAAO,CAAC,GAAG,EACjD,MAAiB,EACjB,EAAE;IACF,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,SAAS,EAAE,EAAE,UAAU,EAAV,+BAAU,EAAE,EAAE,MAAM,CAAC,CAAC;IACpD,OAAO;QACL,oCAAoC;QACpC,WAAW,EAAE,GAAG,EAAE,CAChB,GAAG;aACA,GAAG,CAAC,UAAU,CAAC;aACf,QAAQ,EAAE;aACV,MAAM,CAAC,CAAC,aAAa,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;QAClD,8CAA8C;QAC9C,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC5D,8BAA8B;QAC9B,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE;QACjE,yCAAyC;QACzC,kBAAkB,EAAE,GAAG,EAAE,CACvB,GAAG,CAAC,GAAG,CAAC,sBA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,IAAA,6CAAqC,EAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;IAEpE,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAvCW,QAAA,kBAAkB,sBAuC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/logging/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yCAAyC,CAAC;AACxD,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/logging/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,yCAAyC,CAAC;AACxD,cAAc,mBAAmB,CAAC"}
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./generate-log"), exports);
|
|
18
18
|
__exportStar(require("./log"), exports);
|
|
19
|
+
__exportStar(require("./log-formatter"), exports);
|
|
19
20
|
__exportStar(require("./log-level"), exports);
|
|
20
21
|
__exportStar(require("./log-message"), exports);
|
|
21
22
|
__exportStar(require("./log-retention"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/logging/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,wCAAsB;AACtB,8CAA4B;AAC5B,gDAA8B;AAC9B,kDAAgC;AAChC,2CAAyB;AACzB,oDAAkC;AAClC,kEAAgD;AAChD,yDAAuC;AACvC,0EAAwD;AACxD,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/logging/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,wCAAsB;AACtB,kDAAgC;AAChC,8CAA4B;AAC5B,gDAA8B;AAC9B,kDAAgC;AAChC,2CAAyB;AACzB,oDAAkC;AAClC,kEAAgD;AAChD,yDAAuC;AACvC,0EAAwD;AACxD,oDAAkC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BasicConfig } from '../config';
|
|
2
|
+
import { Log } from './log';
|
|
3
|
+
export interface LogFormatter {
|
|
4
|
+
(log: Log, config: Partial<BasicConfig>): string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A log formatter that adjusts the log output for development environments in
|
|
8
|
+
* a condensed way but in all other cases creates a JSON string to log.
|
|
9
|
+
* With an environment variable `FULL_DEV_LOGS=true` you can enforce the full log.
|
|
10
|
+
* @param log The full log object
|
|
11
|
+
* @param config The service configuration
|
|
12
|
+
* @returns The string to be logged
|
|
13
|
+
*/
|
|
14
|
+
export declare const generalLogFormatter: LogFormatter;
|
|
15
|
+
//# sourceMappingURL=log-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-formatter.d.ts","sourceRoot":"","sources":["../../../src/common/logging/log-formatter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC;CAClD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,YA4BjC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generalLogFormatter = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
5
|
+
const helpers_1 = require("../helpers");
|
|
6
|
+
/**
|
|
7
|
+
* A log formatter that adjusts the log output for development environments in
|
|
8
|
+
* a condensed way but in all other cases creates a JSON string to log.
|
|
9
|
+
* With an environment variable `FULL_DEV_LOGS=true` you can enforce the full log.
|
|
10
|
+
* @param log The full log object
|
|
11
|
+
* @param config The service configuration
|
|
12
|
+
* @returns The string to be logged
|
|
13
|
+
*/
|
|
14
|
+
const generalLogFormatter = (log, config) => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (config.isDev) {
|
|
17
|
+
if (config.fullDevLogs) {
|
|
18
|
+
return coloredJsonWithErrorHighlight((0, helpers_1.removeEmptyProperties)(log));
|
|
19
|
+
}
|
|
20
|
+
const cleaned = (0, helpers_1.removeEmptyProperties)(log);
|
|
21
|
+
const logtime = ((_a = cleaned.logtime) !== null && _a !== void 0 ? _a : new Date().toISOString()).slice(11);
|
|
22
|
+
const details = cleaned.details
|
|
23
|
+
? '\n' + coloredJson(condenseLargeKnownObjects(cleaned.details, log))
|
|
24
|
+
: '';
|
|
25
|
+
switch (cleaned.loglevel) {
|
|
26
|
+
case 'ERROR':
|
|
27
|
+
case 'FATAL': {
|
|
28
|
+
const fullLog = coloredJson(log);
|
|
29
|
+
return `\x1b[91m${logtime} ❗${cleaned.loglevel}❗ ${cleaned.message} [${cleaned.context}]\x1b[0m\n${fullLog}`;
|
|
30
|
+
}
|
|
31
|
+
case 'WARN':
|
|
32
|
+
return `\x1b[33m${logtime} ${cleaned.loglevel} ${cleaned.message} [${cleaned.context}]\x1b[0m${details}`;
|
|
33
|
+
default:
|
|
34
|
+
return `${logtime} \x1b[36m${cleaned.loglevel}\x1b[0m ${cleaned.message} [${cleaned.context}]${details}`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return JSON.stringify(log);
|
|
38
|
+
};
|
|
39
|
+
exports.generalLogFormatter = generalLogFormatter;
|
|
40
|
+
const condenseLargeKnownObjects = (details, log) => {
|
|
41
|
+
for (const key in details) {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
const value = details[key];
|
|
44
|
+
// In local development there are often all permissions assigned to subjects
|
|
45
|
+
if (key === 'auth_info' && typeof (value === null || value === void 0 ? void 0 : value.permissions) === 'object') {
|
|
46
|
+
let permissions = 'From the following services: ';
|
|
47
|
+
for (const permKey in value.permissions) {
|
|
48
|
+
permissions += `${permKey},`;
|
|
49
|
+
}
|
|
50
|
+
value.permissions = permissions;
|
|
51
|
+
}
|
|
52
|
+
if (typeof details[key] === 'object') {
|
|
53
|
+
details[key] = condenseLargeKnownObjects(details[key], log);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return details;
|
|
57
|
+
};
|
|
58
|
+
/** Colors ERROR and FATAL in red and WARN in yellow in the DEV console */
|
|
59
|
+
const coloredJsonWithErrorHighlight = (log) => coloredJson(log)
|
|
60
|
+
.replaceAll("\x1b[32m'FATAL'", "\x1b[31m'FATAL'")
|
|
61
|
+
.replaceAll("\x1b[32m'ERROR'", "\x1b[31m'ERROR'")
|
|
62
|
+
.replaceAll("\x1b[32m'WARN'", "\x1b[33m'WARN'");
|
|
63
|
+
/** Changes numbers/booleans to a light green to look similar to the color used for JSON strings */
|
|
64
|
+
const coloredJson = (log) => (0, util_1.inspect)(log, {
|
|
65
|
+
depth: null,
|
|
66
|
+
colors: true,
|
|
67
|
+
}).replaceAll('\x1b[33m', '\x1b[92m');
|
|
68
|
+
//# sourceMappingURL=log-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-formatter.js","sourceRoot":"","sources":["../../../src/common/logging/log-formatter.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B,wCAAmD;AAQnD;;;;;;;GAOG;AACI,MAAM,mBAAmB,GAAiB,CAC/C,GAAQ,EACR,MAA4B,EAC5B,EAAE;;IACF,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,IAAI,MAAM,CAAC,WAAW,EAAE;YACtB,OAAO,6BAA6B,CAAC,IAAA,+BAAqB,EAAC,GAAG,CAAC,CAAC,CAAC;SAClE;QACD,MAAM,OAAO,GAAG,IAAA,+BAAqB,EAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,CACd,MAAC,OAAO,CAAC,OAAkB,mCAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CACxD,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACZ,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO;YAC7B,CAAC,CAAC,IAAI,GAAG,WAAW,CAAC,yBAAyB,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACrE,CAAC,CAAC,EAAE,CAAC;QACP,QAAQ,OAAO,CAAC,QAAQ,EAAE;YACxB,KAAK,OAAO,CAAC;YACb,KAAK,OAAO,CAAC,CAAC;gBACZ,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;gBACjC,OAAO,WAAW,OAAO,KAAK,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,aAAa,OAAO,EAAE,CAAC;aAC9G;YACD,KAAK,MAAM;gBACT,OAAO,WAAW,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,WAAW,OAAO,EAAE,CAAC;YAC3G;gBACE,OAAO,GAAG,OAAO,Y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C3C,IAAA,cAAO,EAAC,GAAG,EAAE;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;CACb,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BasicConfig } from '../config';
|
|
2
2
|
import { LogMiddleware } from './generate-log';
|
|
3
|
+
import { LogFormatter } from './log-formatter';
|
|
3
4
|
import { LogLevel } from './log-level';
|
|
4
5
|
import { LogMessage } from './log-message';
|
|
5
6
|
import { MaskMiddleware } from './mask-middleware';
|
|
@@ -37,27 +38,41 @@ export interface LoggerOptions {
|
|
|
37
38
|
* Middleware functions that are applied in the given order to change the log details object before writing the log.
|
|
38
39
|
*/
|
|
39
40
|
logMiddleware?: LogMiddleware[];
|
|
41
|
+
/**
|
|
42
|
+
* A custom function that is called before writing the log file to customize to log format
|
|
43
|
+
*/
|
|
44
|
+
logFormatter?: LogFormatter;
|
|
40
45
|
}
|
|
41
46
|
/**
|
|
42
|
-
* Sets masking middleware that is
|
|
43
|
-
*
|
|
44
|
-
*
|
|
47
|
+
* Sets the masking middleware that is then used by all Loggers that do not
|
|
48
|
+
* provide a custom middleware as a Logger constructor parameter.
|
|
49
|
+
* It is possible to unset the middleware if this function is called without
|
|
50
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
45
51
|
*/
|
|
46
52
|
export declare const setupGlobalMaskMiddleware: (middleware?: MaskMiddleware) => void;
|
|
47
53
|
/**
|
|
48
|
-
* Sets skip masking middleware that is
|
|
49
|
-
*
|
|
50
|
-
*
|
|
54
|
+
* Sets the skip masking middleware that is then used by all Loggers that do not
|
|
55
|
+
* provide a custom skip middleware as a Logger constructor parameter.
|
|
56
|
+
* It is possible to unset the middleware if this function is called without
|
|
57
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
51
58
|
*/
|
|
52
59
|
export declare const setupGlobalSkipMaskMiddleware: (middleware?: SkipMaskMiddleware) => void;
|
|
53
60
|
/**
|
|
54
|
-
* Sets log middleware that
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
61
|
+
* Sets the log middleware that is then used by all Loggers that do not provide
|
|
62
|
+
* a custom skip middleware as a Logger constructor parameter.
|
|
63
|
+
* The middleware passed to a specific Logger instances is executed first and
|
|
64
|
+
* the globally set middleware is launched last.
|
|
65
|
+
* It is possible to unset the middleware if this function is called without
|
|
66
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
59
67
|
*/
|
|
60
68
|
export declare const setupGlobalLogMiddleware: (middleware?: LogMiddleware[]) => void;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the log formatter that is then used by all Loggers that do not provide a
|
|
71
|
+
* custom log formatter as a Logger constructor parameter.
|
|
72
|
+
* It is possible to unset the middleware if this function is called without
|
|
73
|
+
* passing any parameter.
|
|
74
|
+
*/
|
|
75
|
+
export declare const setupGlobalLogFormatter: (formatter?: LogFormatter) => void;
|
|
61
76
|
/**
|
|
62
77
|
* Default Mosaic logger class. Used to write logs to the console in JSON format (no line breaks).
|
|
63
78
|
*/
|
|
@@ -68,6 +83,7 @@ export declare class Logger {
|
|
|
68
83
|
private readonly maskMiddleware?;
|
|
69
84
|
private readonly skipMaskMiddleware?;
|
|
70
85
|
private readonly logMiddleware;
|
|
86
|
+
private readonly logFormatter?;
|
|
71
87
|
/**
|
|
72
88
|
* Creates a Logger instance using provided options object.
|
|
73
89
|
* Default values are used if options are not provided.
|
|
@@ -109,17 +125,25 @@ export declare class Logger {
|
|
|
109
125
|
}): void;
|
|
110
126
|
private skipLog;
|
|
111
127
|
/**
|
|
112
|
-
* Gets middleware
|
|
128
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
129
|
+
* instance can be created before the global log middleware setup.
|
|
113
130
|
*/
|
|
114
131
|
private getMaskMiddleware;
|
|
115
132
|
/**
|
|
116
|
-
* Gets middleware
|
|
133
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
134
|
+
* instance can be created before the global log middleware setup.
|
|
117
135
|
*/
|
|
118
136
|
private getSkipMaskMiddleware;
|
|
119
137
|
/**
|
|
120
|
-
* Gets middleware
|
|
138
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
139
|
+
* instance can be created before the global log middleware setup.
|
|
121
140
|
*/
|
|
122
141
|
private getLogMiddleware;
|
|
142
|
+
/**
|
|
143
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
144
|
+
* instance can be created before the global log middleware setup.
|
|
145
|
+
*/
|
|
146
|
+
private getLogFormatter;
|
|
123
147
|
private format;
|
|
124
148
|
private getLogRetention;
|
|
125
149
|
private processArgsAndWriteLog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/common/logging/logger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/common/logging/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAwC,MAAM,WAAW,CAAC;AAE9E,OAAO,EAAE,aAAa,EAAe,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAuB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EACL,cAAc,EAGf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,kBAAkB,EAEnB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAE9B;;OAEG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;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Ae;IAuBvB,OAAO,CAAC,sBAAsB;CAY/B"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Logger = exports.setupGlobalLogMiddleware = exports.setupGlobalSkipMaskMiddleware = exports.setupGlobalMaskMiddleware = void 0;
|
|
3
|
+
exports.Logger = exports.setupGlobalLogFormatter = exports.setupGlobalLogMiddleware = exports.setupGlobalSkipMaskMiddleware = exports.setupGlobalMaskMiddleware = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
const util_1 = require("util");
|
|
6
5
|
const config_1 = require("../config");
|
|
7
6
|
const errors_1 = require("../errors");
|
|
8
|
-
const helpers_1 = require("../helpers");
|
|
9
7
|
const generate_log_1 = require("./generate-log");
|
|
8
|
+
const log_formatter_1 = require("./log-formatter");
|
|
10
9
|
const log_level_1 = require("./log-level");
|
|
11
10
|
const log_retention_1 = require("./log-retention");
|
|
12
11
|
const mask_middleware_1 = require("./mask-middleware");
|
|
13
12
|
const skip_mask_middleware_1 = require("./skip-mask-middleware");
|
|
14
13
|
let globalMaskMiddleware;
|
|
15
14
|
/**
|
|
16
|
-
* Sets masking middleware that is
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* Sets the masking middleware that is then used by all Loggers that do not
|
|
16
|
+
* provide a custom middleware as a Logger constructor parameter.
|
|
17
|
+
* It is possible to unset the middleware if this function is called without
|
|
18
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
19
19
|
*/
|
|
20
20
|
const setupGlobalMaskMiddleware = (middleware) => {
|
|
21
21
|
globalMaskMiddleware = middleware;
|
|
@@ -23,9 +23,10 @@ const setupGlobalMaskMiddleware = (middleware) => {
|
|
|
23
23
|
exports.setupGlobalMaskMiddleware = setupGlobalMaskMiddleware;
|
|
24
24
|
let globalSkipMaskMiddleware;
|
|
25
25
|
/**
|
|
26
|
-
* Sets skip masking middleware that is
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Sets the skip masking middleware that is then used by all Loggers that do not
|
|
27
|
+
* provide a custom skip middleware as a Logger constructor parameter.
|
|
28
|
+
* It is possible to unset the middleware if this function is called without
|
|
29
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
29
30
|
*/
|
|
30
31
|
const setupGlobalSkipMaskMiddleware = (middleware) => {
|
|
31
32
|
globalSkipMaskMiddleware = middleware;
|
|
@@ -33,16 +34,28 @@ const setupGlobalSkipMaskMiddleware = (middleware) => {
|
|
|
33
34
|
exports.setupGlobalSkipMaskMiddleware = setupGlobalSkipMaskMiddleware;
|
|
34
35
|
let globalLogMiddleware;
|
|
35
36
|
/**
|
|
36
|
-
* Sets log middleware that
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* Sets the log middleware that is then used by all Loggers that do not provide
|
|
38
|
+
* a custom skip middleware as a Logger constructor parameter.
|
|
39
|
+
* The middleware passed to a specific Logger instances is executed first and
|
|
40
|
+
* the globally set middleware is launched last.
|
|
41
|
+
* It is possible to unset the middleware if this function is called without
|
|
42
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
41
43
|
*/
|
|
42
44
|
const setupGlobalLogMiddleware = (middleware) => {
|
|
43
45
|
globalLogMiddleware = middleware;
|
|
44
46
|
};
|
|
45
47
|
exports.setupGlobalLogMiddleware = setupGlobalLogMiddleware;
|
|
48
|
+
let globalLogFormatter;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the log formatter that is then used by all Loggers that do not provide a
|
|
51
|
+
* custom log formatter as a Logger constructor parameter.
|
|
52
|
+
* It is possible to unset the middleware if this function is called without
|
|
53
|
+
* passing any parameter.
|
|
54
|
+
*/
|
|
55
|
+
const setupGlobalLogFormatter = (formatter) => {
|
|
56
|
+
globalLogFormatter = formatter;
|
|
57
|
+
};
|
|
58
|
+
exports.setupGlobalLogFormatter = setupGlobalLogFormatter;
|
|
46
59
|
/**
|
|
47
60
|
* Default Mosaic logger class. Used to write logs to the console in JSON format (no line breaks).
|
|
48
61
|
*/
|
|
@@ -60,6 +73,7 @@ class Logger {
|
|
|
60
73
|
this.skipMaskMiddleware = options === null || options === void 0 ? void 0 : options.skipMaskMiddleware;
|
|
61
74
|
this.maxLevel = this.setMaxLogLevel();
|
|
62
75
|
this.logMiddleware = (options === null || options === void 0 ? void 0 : options.logMiddleware) || [];
|
|
76
|
+
this.logFormatter = options === null || options === void 0 ? void 0 : options.logFormatter;
|
|
63
77
|
}
|
|
64
78
|
setMaxLogLevel() {
|
|
65
79
|
var _a;
|
|
@@ -122,25 +136,36 @@ class Logger {
|
|
|
122
136
|
return level > this.maxLevel;
|
|
123
137
|
}
|
|
124
138
|
/**
|
|
125
|
-
* Gets middleware
|
|
139
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
140
|
+
* instance can be created before the global log middleware setup.
|
|
126
141
|
*/
|
|
127
142
|
getMaskMiddleware() {
|
|
128
143
|
var _a, _b;
|
|
129
144
|
return (_b = (_a = this.maskMiddleware) !== null && _a !== void 0 ? _a : globalMaskMiddleware) !== null && _b !== void 0 ? _b : mask_middleware_1.defaultMaskMiddleware;
|
|
130
145
|
}
|
|
131
146
|
/**
|
|
132
|
-
* Gets middleware
|
|
147
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
148
|
+
* instance can be created before the global log middleware setup.
|
|
133
149
|
*/
|
|
134
150
|
getSkipMaskMiddleware() {
|
|
135
151
|
var _a, _b;
|
|
136
152
|
return ((_b = (_a = this.skipMaskMiddleware) !== null && _a !== void 0 ? _a : globalSkipMaskMiddleware) !== null && _b !== void 0 ? _b : skip_mask_middleware_1.defaultSkipMaskMiddleware);
|
|
137
153
|
}
|
|
138
154
|
/**
|
|
139
|
-
* Gets middleware
|
|
155
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
156
|
+
* instance can be created before the global log middleware setup.
|
|
140
157
|
*/
|
|
141
158
|
getLogMiddleware() {
|
|
142
159
|
return [...this.logMiddleware, ...(globalLogMiddleware !== null && globalLogMiddleware !== void 0 ? globalLogMiddleware : [])];
|
|
143
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
163
|
+
* instance can be created before the global log middleware setup.
|
|
164
|
+
*/
|
|
165
|
+
getLogFormatter() {
|
|
166
|
+
var _a, _b;
|
|
167
|
+
return (_b = (_a = this.logFormatter) !== null && _a !== void 0 ? _a : globalLogFormatter) !== null && _b !== void 0 ? _b : log_formatter_1.generalLogFormatter;
|
|
168
|
+
}
|
|
144
169
|
format(level, message, error) {
|
|
145
170
|
var _a;
|
|
146
171
|
const log = (0, generate_log_1.generateLog)({
|
|
@@ -163,13 +188,7 @@ class Logger {
|
|
|
163
188
|
if (log === undefined) {
|
|
164
189
|
return undefined;
|
|
165
190
|
}
|
|
166
|
-
|
|
167
|
-
return (0, util_1.inspect)((0, helpers_1.removeEmptyProperties)(log), {
|
|
168
|
-
depth: null,
|
|
169
|
-
colors: true,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
return JSON.stringify(log);
|
|
191
|
+
return this.getLogFormatter()(log, this.config);
|
|
173
192
|
}
|
|
174
193
|
getLogRetention(level, message) {
|
|
175
194
|
//return retention from message, if exists
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/common/logging/logger.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/common/logging/logger.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,sCAA8E;AAC9E,sCAAiD;AACjD,iDAA4D;AAE5D,mDAAoE;AACpE,2CAAuC;AAEvC,mDAA+C;AAC/C,uDAI2B;AAC3B,iEAGgC;AA8ChC,IAAI,oBAAgD,CAAC;AAErD;;;;;GAKG;AACI,MAAM,yBAAyB,GAAG,CACvC,UAA2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rc.0",
|
|
4
4
|
"description": "Common helpers and PostgreSQL-related functionality",
|
|
5
5
|
"author": "Axinom",
|
|
6
6
|
"license": "PROPRIETARY",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"jest": "^29",
|
|
44
44
|
"jest-expect-message": "^1.1.3",
|
|
45
45
|
"moment": "^2.29.1",
|
|
46
|
-
"pg": "^8.5.1",
|
|
47
46
|
"prom-client": "^13.2.0",
|
|
48
47
|
"serialize-error": "^7.0.1",
|
|
49
48
|
"short-hash": "^1.0.0",
|
|
@@ -67,5 +66,5 @@
|
|
|
67
66
|
"publishConfig": {
|
|
68
67
|
"access": "public"
|
|
69
68
|
},
|
|
70
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "0818b5a39695ec1b66f6284b7e69300a625729b4"
|
|
71
70
|
}
|
|
@@ -37,6 +37,7 @@ import { asDbIdentifier, asLogLevel } from './env-var-extensions';
|
|
|
37
37
|
* healthEndpointPort // e.g. HEALTH_ENDPOINT_PORT=9000
|
|
38
38
|
* secureLoggingMode // e.g. SECURE_LOGGING_MODE=UNSAFE_SECRETS_NOT_HIDDEN_UNSAFE
|
|
39
39
|
* logMaskKeywords // e.g. LOG_MASK_KEYWORDS=secret,password,connectionString
|
|
40
|
+
* fullDevLogs // e.g. FULL_DEV_LOGS=true
|
|
40
41
|
* isDev // true for NODE_ENV=development
|
|
41
42
|
* isProd // true for NODE_ENV=production
|
|
42
43
|
* ```
|
|
@@ -74,6 +75,8 @@ export const getBasicConfigDefinitions = (
|
|
|
74
75
|
/** @example LOG_MASK_KEYWORDS=secret,password,connectionString */
|
|
75
76
|
logMaskKeywords: () =>
|
|
76
77
|
env.get('LOG_MASK_KEYWORDS').default(defaultMaskKeywords).asArray(),
|
|
78
|
+
/** @example FULL_DEV_LOGS=true */
|
|
79
|
+
fullDevLogs: () => env.get('FULL_DEV_LOGS').default('false').asBool(),
|
|
77
80
|
/** @example NODE_ENV=development */
|
|
78
81
|
isDev: function () {
|
|
79
82
|
return this.environment() === 'development';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { generalLogFormatter } from './log-formatter';
|
|
2
|
+
|
|
3
|
+
const log = {
|
|
4
|
+
logtime: '2023-10-16T09:23:35.381Z',
|
|
5
|
+
loglevel: 'INFO',
|
|
6
|
+
message: 'This is a log message',
|
|
7
|
+
context: 'TestContext',
|
|
8
|
+
retention: 'medium',
|
|
9
|
+
details: {
|
|
10
|
+
key: 'value',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('Log Formatters', () => {
|
|
15
|
+
it('generalLogFormatter formats logs as JSON if config is not DEV', () => {
|
|
16
|
+
// Arrange
|
|
17
|
+
const config = {
|
|
18
|
+
isDev: false,
|
|
19
|
+
fullDevLogs: true,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Act
|
|
23
|
+
const formattedLog = generalLogFormatter(log, config);
|
|
24
|
+
|
|
25
|
+
// Assert
|
|
26
|
+
expect(formattedLog).toBe(JSON.stringify(log));
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('generalLogFormatter formats logs as colored JSON if config is DEV and fullDevLogs is true', () => {
|
|
30
|
+
// Arrange
|
|
31
|
+
const config = {
|
|
32
|
+
isDev: true,
|
|
33
|
+
fullDevLogs: true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Act
|
|
37
|
+
const formattedLog = generalLogFormatter(log, config);
|
|
38
|
+
|
|
39
|
+
// Assert
|
|
40
|
+
const expectedLog = `{
|
|
41
|
+
logtime: \x1b[32m'2023-10-16T09:23:35.381Z'\x1b[39m,
|
|
42
|
+
loglevel: \x1b[32m'INFO'\x1b[39m,
|
|
43
|
+
message: \x1b[32m'This is a log message'\x1b[39m,
|
|
44
|
+
context: \x1b[32m'TestContext'\x1b[39m,
|
|
45
|
+
retention: \x1b[32m'medium'\x1b[39m,
|
|
46
|
+
details: { key: \x1b[32m'value'\x1b[39m }
|
|
47
|
+
}`;
|
|
48
|
+
expect(formattedLog).toBe(expectedLog);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('generalLogFormatter formats a normal log entry in a condensed way if config is DEV and fullDevLogs is false', () => {
|
|
52
|
+
// Arrange
|
|
53
|
+
const config = {
|
|
54
|
+
isDev: true,
|
|
55
|
+
fullDevLogs: false,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Act
|
|
59
|
+
const formattedLog = generalLogFormatter(log, config);
|
|
60
|
+
|
|
61
|
+
// Assert
|
|
62
|
+
const expectedLog = `09:23:35.381Z \x1b[36mINFO\x1b[0m This is a log message [TestContext]
|
|
63
|
+
{ key: \x1b[32m'value'\x1b[39m }`;
|
|
64
|
+
expect(formattedLog).toBe(expectedLog);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it.each(['ERROR', 'FATAL'])(
|
|
68
|
+
'generalLogFormatter formats a %p log entry in red in a condensed way if config is DEV and fullDevLogs is false',
|
|
69
|
+
(loglevel) => {
|
|
70
|
+
// Arrange
|
|
71
|
+
const config = {
|
|
72
|
+
isDev: true,
|
|
73
|
+
fullDevLogs: false,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Act
|
|
77
|
+
const formattedLog = generalLogFormatter({ ...log, loglevel }, config);
|
|
78
|
+
|
|
79
|
+
// Assert
|
|
80
|
+
const expectedLog = `\x1b[91m09:23:35.381Z ❗${loglevel}❗ This is a log message [TestContext]\x1b[0m
|
|
81
|
+
{
|
|
82
|
+
logtime: \x1b[32m'2023-10-16T09:23:35.381Z'\x1b[39m,
|
|
83
|
+
loglevel: \x1b[32m'${loglevel}'\x1b[39m,
|
|
84
|
+
message: \x1b[32m'This is a log message'\x1b[39m,
|
|
85
|
+
context: \x1b[32m'TestContext'\x1b[39m,
|
|
86
|
+
retention: \x1b[32m'medium'\x1b[39m,
|
|
87
|
+
details: { key: \x1b[32m'value'\x1b[39m }
|
|
88
|
+
}`;
|
|
89
|
+
expect(formattedLog).toBe(expectedLog);
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
it('generalLogFormatter formats a WARN log entry in a condensed way if config is DEV and fullDevLogs is false', () => {
|
|
94
|
+
// Arrange
|
|
95
|
+
const config = {
|
|
96
|
+
isDev: true,
|
|
97
|
+
fullDevLogs: false,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// Act
|
|
101
|
+
const formattedLog = generalLogFormatter(
|
|
102
|
+
{ ...log, loglevel: 'WARN' },
|
|
103
|
+
config,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
// Assert
|
|
107
|
+
const expectedLog = `\x1b[33m09:23:35.381Z WARN This is a log message [TestContext]\x1b[0m
|
|
108
|
+
{ key: \x1b[32m'value'\x1b[39m }`;
|
|
109
|
+
expect(formattedLog).toBe(expectedLog);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { inspect } from 'util';
|
|
2
|
+
import { BasicConfig } from '../config';
|
|
3
|
+
import { removeEmptyProperties } from '../helpers';
|
|
4
|
+
import { Dict } from '../types';
|
|
5
|
+
import { Log } from './log';
|
|
6
|
+
|
|
7
|
+
export interface LogFormatter {
|
|
8
|
+
(log: Log, config: Partial<BasicConfig>): string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A log formatter that adjusts the log output for development environments in
|
|
13
|
+
* a condensed way but in all other cases creates a JSON string to log.
|
|
14
|
+
* With an environment variable `FULL_DEV_LOGS=true` you can enforce the full log.
|
|
15
|
+
* @param log The full log object
|
|
16
|
+
* @param config The service configuration
|
|
17
|
+
* @returns The string to be logged
|
|
18
|
+
*/
|
|
19
|
+
export const generalLogFormatter: LogFormatter = (
|
|
20
|
+
log: Log,
|
|
21
|
+
config: Partial<BasicConfig>,
|
|
22
|
+
) => {
|
|
23
|
+
if (config.isDev) {
|
|
24
|
+
if (config.fullDevLogs) {
|
|
25
|
+
return coloredJsonWithErrorHighlight(removeEmptyProperties(log));
|
|
26
|
+
}
|
|
27
|
+
const cleaned = removeEmptyProperties(log);
|
|
28
|
+
const logtime = (
|
|
29
|
+
(cleaned.logtime as string) ?? new Date().toISOString()
|
|
30
|
+
).slice(11);
|
|
31
|
+
const details = cleaned.details
|
|
32
|
+
? '\n' + coloredJson(condenseLargeKnownObjects(cleaned.details, log))
|
|
33
|
+
: '';
|
|
34
|
+
switch (cleaned.loglevel) {
|
|
35
|
+
case 'ERROR':
|
|
36
|
+
case 'FATAL': {
|
|
37
|
+
const fullLog = coloredJson(log);
|
|
38
|
+
return `\x1b[91m${logtime} ❗${cleaned.loglevel}❗ ${cleaned.message} [${cleaned.context}]\x1b[0m\n${fullLog}`;
|
|
39
|
+
}
|
|
40
|
+
case 'WARN':
|
|
41
|
+
return `\x1b[33m${logtime} ${cleaned.loglevel} ${cleaned.message} [${cleaned.context}]\x1b[0m${details}`;
|
|
42
|
+
default:
|
|
43
|
+
return `${logtime} \x1b[36m${cleaned.loglevel}\x1b[0m ${cleaned.message} [${cleaned.context}]${details}`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return JSON.stringify(log);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const condenseLargeKnownObjects = (
|
|
50
|
+
details: Dict<unknown>,
|
|
51
|
+
log: Log,
|
|
52
|
+
): Dict<unknown> => {
|
|
53
|
+
for (const key in details) {
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
+
const value = details[key] as any;
|
|
56
|
+
|
|
57
|
+
// In local development there are often all permissions assigned to subjects
|
|
58
|
+
if (key === 'auth_info' && typeof value?.permissions === 'object') {
|
|
59
|
+
let permissions = 'From the following services: ';
|
|
60
|
+
for (const permKey in value.permissions) {
|
|
61
|
+
permissions += `${permKey},`;
|
|
62
|
+
}
|
|
63
|
+
value.permissions = permissions;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (typeof details[key] === 'object') {
|
|
67
|
+
details[key] = condenseLargeKnownObjects(
|
|
68
|
+
details[key] as Dict<unknown>,
|
|
69
|
+
log,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return details;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** Colors ERROR and FATAL in red and WARN in yellow in the DEV console */
|
|
77
|
+
const coloredJsonWithErrorHighlight = (log: unknown): string =>
|
|
78
|
+
coloredJson(log)
|
|
79
|
+
.replaceAll("\x1b[32m'FATAL'", "\x1b[31m'FATAL'")
|
|
80
|
+
.replaceAll("\x1b[32m'ERROR'", "\x1b[31m'ERROR'")
|
|
81
|
+
.replaceAll("\x1b[32m'WARN'", "\x1b[33m'WARN'");
|
|
82
|
+
|
|
83
|
+
/** Changes numbers/booleans to a light green to look similar to the color used for JSON strings */
|
|
84
|
+
const coloredJson = (log: unknown): string =>
|
|
85
|
+
inspect(log, {
|
|
86
|
+
depth: null,
|
|
87
|
+
colors: true,
|
|
88
|
+
}).replaceAll('\x1b[33m', '\x1b[92m');
|
|
@@ -13,6 +13,7 @@ import { LogMessage } from './log-message';
|
|
|
13
13
|
import { LogRetention } from './log-retention';
|
|
14
14
|
import {
|
|
15
15
|
Logger,
|
|
16
|
+
setupGlobalLogFormatter,
|
|
16
17
|
setupGlobalMaskMiddleware,
|
|
17
18
|
setupGlobalSkipMaskMiddleware,
|
|
18
19
|
} from './logger';
|
|
@@ -65,6 +66,7 @@ describe('Logger', () => {
|
|
|
65
66
|
afterEach(() => {
|
|
66
67
|
setupGlobalSkipMaskMiddleware();
|
|
67
68
|
setupGlobalMaskMiddleware();
|
|
69
|
+
setupGlobalLogFormatter();
|
|
68
70
|
jest.restoreAllMocks();
|
|
69
71
|
});
|
|
70
72
|
|
|
@@ -1094,7 +1096,10 @@ describe('Logger', () => {
|
|
|
1094
1096
|
it('logs with development env -> properties ignored', () => {
|
|
1095
1097
|
// Arrange
|
|
1096
1098
|
const config = createTestLogConfig({ NODE_ENV: 'development' });
|
|
1097
|
-
const testLogger = new Logger({
|
|
1099
|
+
const testLogger = new Logger({
|
|
1100
|
+
config: { ...config, fullDevLogs: true },
|
|
1101
|
+
context: 'LoggerTests',
|
|
1102
|
+
});
|
|
1098
1103
|
|
|
1099
1104
|
const logOverride = jest
|
|
1100
1105
|
.spyOn(console, 'log')
|
|
@@ -1596,5 +1601,48 @@ describe('Logger', () => {
|
|
|
1596
1601
|
};
|
|
1597
1602
|
expect(loggedObject).toEqual(referenceObject);
|
|
1598
1603
|
});
|
|
1604
|
+
|
|
1605
|
+
it('Use the given log formatter if one is provided', () => {
|
|
1606
|
+
// Arrange
|
|
1607
|
+
const globalFormatter = (log: Log) => `{ "msg":"${log.message}_global"}`;
|
|
1608
|
+
setupGlobalLogFormatter(globalFormatter);
|
|
1609
|
+
const logFormatter = (log: Log) => `{ "msg":"${log.message}_local"}`;
|
|
1610
|
+
const l = new Logger({ logFormatter });
|
|
1611
|
+
|
|
1612
|
+
// Act
|
|
1613
|
+
l.error({ message: 'test' } as any);
|
|
1614
|
+
|
|
1615
|
+
// Assert
|
|
1616
|
+
expect(consoleOverride).toHaveBeenCalledTimes(1);
|
|
1617
|
+
|
|
1618
|
+
const loggedText = getFirstMockResult<any>(consoleOverride);
|
|
1619
|
+
expect(loggedText).toEqual({ msg: 'test_local' });
|
|
1620
|
+
});
|
|
1621
|
+
|
|
1622
|
+
it('Use the global log formatter if one is set', () => {
|
|
1623
|
+
// Arrange
|
|
1624
|
+
const globalFormatter = (log: Log) => `{ "msg":"${log.message}_global"}`;
|
|
1625
|
+
setupGlobalLogFormatter(globalFormatter);
|
|
1626
|
+
|
|
1627
|
+
// Act
|
|
1628
|
+
logger.error({ message: 'test' } as any);
|
|
1629
|
+
|
|
1630
|
+
// Assert
|
|
1631
|
+
expect(consoleOverride).toHaveBeenCalledTimes(1);
|
|
1632
|
+
|
|
1633
|
+
const loggedText = getFirstMockResult<any>(consoleOverride);
|
|
1634
|
+
expect(loggedText).toEqual({ msg: 'test_global' });
|
|
1635
|
+
});
|
|
1636
|
+
|
|
1637
|
+
it('Use the generalLogFormatter if no custom one is set is set', () => {
|
|
1638
|
+
// Act
|
|
1639
|
+
logger.error({ message: 'test123' } as any);
|
|
1640
|
+
|
|
1641
|
+
// Assert
|
|
1642
|
+
expect(consoleOverride).toHaveBeenCalledTimes(1);
|
|
1643
|
+
|
|
1644
|
+
const loggedText = getFirstMockResult<any>(consoleOverride);
|
|
1645
|
+
expect(loggedText.message).toBe('test123');
|
|
1646
|
+
});
|
|
1599
1647
|
});
|
|
1600
1648
|
});
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { inspect } from 'util';
|
|
3
2
|
import { BasicConfig, getBasicConfigDefinitions, getConfig } from '../config';
|
|
4
3
|
import { UnreachableCaseError } from '../errors';
|
|
5
|
-
import {
|
|
6
|
-
import { generateLog, LogMiddleware } from './generate-log';
|
|
4
|
+
import { LogMiddleware, generateLog } from './generate-log';
|
|
7
5
|
import { Log } from './log';
|
|
6
|
+
import { LogFormatter, generalLogFormatter } from './log-formatter';
|
|
8
7
|
import { LogLevel } from './log-level';
|
|
9
8
|
import { LogMessage } from './log-message';
|
|
10
9
|
import { LogRetention } from './log-retention';
|
|
11
10
|
import {
|
|
12
|
-
defaultMaskMiddleware,
|
|
13
11
|
MaskMiddleware,
|
|
14
12
|
MaskMode,
|
|
13
|
+
defaultMaskMiddleware,
|
|
15
14
|
} from './mask-middleware';
|
|
16
15
|
import {
|
|
17
|
-
defaultSkipMaskMiddleware,
|
|
18
16
|
SkipMaskMiddleware,
|
|
17
|
+
defaultSkipMaskMiddleware,
|
|
19
18
|
} from './skip-mask-middleware';
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -55,14 +54,20 @@ export interface LoggerOptions {
|
|
|
55
54
|
* Middleware functions that are applied in the given order to change the log details object before writing the log.
|
|
56
55
|
*/
|
|
57
56
|
logMiddleware?: LogMiddleware[];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A custom function that is called before writing the log file to customize to log format
|
|
60
|
+
*/
|
|
61
|
+
logFormatter?: LogFormatter;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
let globalMaskMiddleware: MaskMiddleware | undefined;
|
|
61
65
|
|
|
62
66
|
/**
|
|
63
|
-
* Sets masking middleware that is
|
|
64
|
-
*
|
|
65
|
-
*
|
|
67
|
+
* Sets the masking middleware that is then used by all Loggers that do not
|
|
68
|
+
* provide a custom middleware as a Logger constructor parameter.
|
|
69
|
+
* It is possible to unset the middleware if this function is called without
|
|
70
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
66
71
|
*/
|
|
67
72
|
export const setupGlobalMaskMiddleware = (
|
|
68
73
|
middleware?: MaskMiddleware,
|
|
@@ -71,10 +76,12 @@ export const setupGlobalMaskMiddleware = (
|
|
|
71
76
|
};
|
|
72
77
|
|
|
73
78
|
let globalSkipMaskMiddleware: SkipMaskMiddleware | undefined;
|
|
79
|
+
|
|
74
80
|
/**
|
|
75
|
-
* Sets skip masking middleware that is
|
|
76
|
-
*
|
|
77
|
-
*
|
|
81
|
+
* Sets the skip masking middleware that is then used by all Loggers that do not
|
|
82
|
+
* provide a custom skip middleware as a Logger constructor parameter.
|
|
83
|
+
* It is possible to unset the middleware if this function is called without
|
|
84
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
78
85
|
*/
|
|
79
86
|
export const setupGlobalSkipMaskMiddleware = (
|
|
80
87
|
middleware?: SkipMaskMiddleware,
|
|
@@ -85,11 +92,12 @@ export const setupGlobalSkipMaskMiddleware = (
|
|
|
85
92
|
let globalLogMiddleware: LogMiddleware[] | undefined;
|
|
86
93
|
|
|
87
94
|
/**
|
|
88
|
-
* Sets log middleware that
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
95
|
+
* Sets the log middleware that is then used by all Loggers that do not provide
|
|
96
|
+
* a custom skip middleware as a Logger constructor parameter.
|
|
97
|
+
* The middleware passed to a specific Logger instances is executed first and
|
|
98
|
+
* the globally set middleware is launched last.
|
|
99
|
+
* It is possible to unset the middleware if this function is called without
|
|
100
|
+
* passing any parameter. It is recommended to call it once on app startup.
|
|
93
101
|
*/
|
|
94
102
|
export const setupGlobalLogMiddleware = (
|
|
95
103
|
middleware?: LogMiddleware[],
|
|
@@ -97,6 +105,18 @@ export const setupGlobalLogMiddleware = (
|
|
|
97
105
|
globalLogMiddleware = middleware;
|
|
98
106
|
};
|
|
99
107
|
|
|
108
|
+
let globalLogFormatter: LogFormatter | undefined;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Sets the log formatter that is then used by all Loggers that do not provide a
|
|
112
|
+
* custom log formatter as a Logger constructor parameter.
|
|
113
|
+
* It is possible to unset the middleware if this function is called without
|
|
114
|
+
* passing any parameter.
|
|
115
|
+
*/
|
|
116
|
+
export const setupGlobalLogFormatter = (formatter?: LogFormatter): void => {
|
|
117
|
+
globalLogFormatter = formatter;
|
|
118
|
+
};
|
|
119
|
+
|
|
100
120
|
/**
|
|
101
121
|
* Default Mosaic logger class. Used to write logs to the console in JSON format (no line breaks).
|
|
102
122
|
*/
|
|
@@ -107,6 +127,7 @@ export class Logger {
|
|
|
107
127
|
private readonly maskMiddleware?: MaskMiddleware;
|
|
108
128
|
private readonly skipMaskMiddleware?: SkipMaskMiddleware;
|
|
109
129
|
private readonly logMiddleware: LogMiddleware[];
|
|
130
|
+
private readonly logFormatter?: LogFormatter;
|
|
110
131
|
|
|
111
132
|
/**
|
|
112
133
|
* Creates a Logger instance using provided options object.
|
|
@@ -120,6 +141,7 @@ export class Logger {
|
|
|
120
141
|
this.skipMaskMiddleware = options?.skipMaskMiddleware;
|
|
121
142
|
this.maxLevel = this.setMaxLogLevel();
|
|
122
143
|
this.logMiddleware = options?.logMiddleware || [];
|
|
144
|
+
this.logFormatter = options?.logFormatter;
|
|
123
145
|
}
|
|
124
146
|
|
|
125
147
|
private setMaxLogLevel(): LogLevel {
|
|
@@ -227,14 +249,16 @@ export class Logger {
|
|
|
227
249
|
}
|
|
228
250
|
|
|
229
251
|
/**
|
|
230
|
-
* Gets middleware
|
|
252
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
253
|
+
* instance can be created before the global log middleware setup.
|
|
231
254
|
*/
|
|
232
255
|
private getMaskMiddleware(): MaskMiddleware | undefined {
|
|
233
256
|
return this.maskMiddleware ?? globalMaskMiddleware ?? defaultMaskMiddleware;
|
|
234
257
|
}
|
|
235
258
|
|
|
236
259
|
/**
|
|
237
|
-
* Gets middleware
|
|
260
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
261
|
+
* instance can be created before the global log middleware setup.
|
|
238
262
|
*/
|
|
239
263
|
private getSkipMaskMiddleware(): SkipMaskMiddleware | undefined {
|
|
240
264
|
return (
|
|
@@ -245,12 +269,21 @@ export class Logger {
|
|
|
245
269
|
}
|
|
246
270
|
|
|
247
271
|
/**
|
|
248
|
-
* Gets middleware
|
|
272
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
273
|
+
* instance can be created before the global log middleware setup.
|
|
249
274
|
*/
|
|
250
275
|
private getLogMiddleware(): LogMiddleware[] {
|
|
251
276
|
return [...this.logMiddleware, ...(globalLogMiddleware ?? [])];
|
|
252
277
|
}
|
|
253
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Gets the middleware at the moment of the log generation, since the Logger
|
|
281
|
+
* instance can be created before the global log middleware setup.
|
|
282
|
+
*/
|
|
283
|
+
private getLogFormatter(): LogFormatter {
|
|
284
|
+
return this.logFormatter ?? globalLogFormatter ?? generalLogFormatter;
|
|
285
|
+
}
|
|
286
|
+
|
|
254
287
|
private format(
|
|
255
288
|
level: LogLevel,
|
|
256
289
|
message: string | LogMessage,
|
|
@@ -282,14 +315,7 @@ export class Logger {
|
|
|
282
315
|
return undefined;
|
|
283
316
|
}
|
|
284
317
|
|
|
285
|
-
|
|
286
|
-
return inspect(removeEmptyProperties(log), {
|
|
287
|
-
depth: null,
|
|
288
|
-
colors: true,
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
return JSON.stringify(log);
|
|
318
|
+
return this.getLogFormatter()(log, this.config);
|
|
293
319
|
}
|
|
294
320
|
|
|
295
321
|
private getLogRetention(
|