simple-log-methods 0.6.2 → 0.6.4
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/domain/LogTrail.d.ts +2 -2
- package/dist/index.d.ts +4 -3
- package/dist/index.js.map +1 -1
- package/dist/logic/formatLogContentsForEnvironment.d.ts +1 -1
- package/dist/logic/formatLogContentsForEnvironment.js.map +1 -1
- package/dist/logic/generateLogMethods.d.ts +1 -1
- package/dist/logic/generateLogMethods.js.map +1 -1
- package/dist/logic/withLogTrail.d.ts +11 -5
- package/dist/logic/withLogTrail.js +44 -25
- package/dist/logic/withLogTrail.js.map +1 -1
- package/package.json +37 -33
- package/dist/logic/formatLogContentsForEnvironment.test.d.ts +0 -1
- package/dist/logic/formatLogContentsForEnvironment.test.js +0 -50
- package/dist/logic/formatLogContentsForEnvironment.test.js.map +0 -1
- package/dist/logic/generateLogMethod.test.d.ts +0 -1
- package/dist/logic/generateLogMethod.test.js +0 -50
- package/dist/logic/generateLogMethod.test.js.map +0 -1
- package/dist/logic/generateLogMethods.test.d.ts +0 -1
- package/dist/logic/generateLogMethods.test.js +0 -13
- package/dist/logic/generateLogMethods.test.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Procedure, ProcedureContext } from 'domain-glossary-procedure';
|
|
2
|
-
import { LogMethods } from '../logic/generateLogMethods';
|
|
1
|
+
import type { Procedure, ProcedureContext } from 'domain-glossary-procedure';
|
|
2
|
+
import type { LogMethods } from '../logic/generateLogMethods';
|
|
3
3
|
/**
|
|
4
4
|
* .what = the procedure invocation trail
|
|
5
5
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { LogLevel } from './domain/constants';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
2
|
+
export type { ContextLogTrail, HasContextLogTrail, LogTrail, } from './domain/LogTrail';
|
|
3
|
+
export type { LogMethod } from './logic/generateLogMethod';
|
|
4
|
+
export type { LogMethods } from './logic/generateLogMethods';
|
|
5
|
+
export { generateLogMethods } from './logic/generateLogMethods';
|
|
5
6
|
export { withLogTrail } from './logic/withLogTrail';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAArC,qGAAA,QAAQ,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAArC,qGAAA,QAAQ,OAAA;AAQjB,iEAAgE;AAAvD,wHAAA,kBAAkB,OAAA;AAC3B,qDAAoD;AAA3C,4GAAA,YAAY,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatLogContentsForEnvironment.js","sourceRoot":"","sources":["../../src/logic/formatLogContentsForEnvironment.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"formatLogContentsForEnvironment.js","sourceRoot":"","sources":["../../src/logic/formatLogContentsForEnvironment.ts"],"names":[],"mappings":";;;AAAA,mDAA0E;AAC1E,+DAA4D;AAErD,MAAM,+BAA+B,GAAG,CAAC,EAC9C,KAAK,EACL,SAAS,EACT,OAAO,EACP,QAAQ,GAMT,EAAE,EAAE;IACH,MAAM,GAAG,GAAG,IAAA,yCAAmB,GAAE,CAAC;IAElC,0HAA0H;IAC1H,IAAI,GAAG,KAAK,gCAAoB,CAAC,KAAK,EAAE,CAAC;QACvC,OAAO;YACL,KAAK;YACL,SAAS;YACT,OAAO;YACP,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,mEAAmE;SACxG,CAAC;IACJ,CAAC;IAED,qKAAqK;IACrK,IAAI,GAAG,KAAK,gCAAoB,CAAC,UAAU,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK;YACL,SAAS;YACT,OAAO;YACP,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IAED,wJAAwJ;IACxJ,IAAI,GAAG,KAAK,gCAAoB,CAAC,WAAW,EAAE,CAAC;QAC7C,OAAO;YACL,KAAK;YACL,SAAS;YACT,OAAO;YACP,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,MAAM,IAAI,KAAK,CACb,oGAAoG,CACrG,CAAC,CAAC,YAAY;AACjB,CAAC,CAAC;AA/CW,QAAA,+BAA+B,mCA+C1C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogLevel } from '../domain/constants';
|
|
2
|
-
import { LogMethod } from './generateLogMethod';
|
|
2
|
+
import { type LogMethod } from './generateLogMethod';
|
|
3
3
|
export interface LogMethods {
|
|
4
4
|
/**
|
|
5
5
|
* `error` level logs are used to indicate a critical and urgent failure that requires immediate resolution
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateLogMethods.js","sourceRoot":"","sources":["../../src/logic/generateLogMethods.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"generateLogMethods.js","sourceRoot":"","sources":["../../src/logic/generateLogMethods.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAC/C,2DAAwE;AACxE,+GAA4G;AAgC5G;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,EACjC,eAAe,GAAG,IAAA,yFAA2C,GAAE,MAG7D,EAAE,EAAc,EAAE;IACpB,uBAAuB;IACvB,OAAO;QACL,KAAK,EAAE,IAAA,qCAAiB,EAAC,EAAE,KAAK,EAAE,oBAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC;QACpE,IAAI,EAAE,IAAA,qCAAiB,EAAC,EAAE,KAAK,EAAE,oBAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC;QAClE,IAAI,EAAE,IAAA,qCAAiB,EAAC,EAAE,KAAK,EAAE,oBAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,CAAC;QAClE,KAAK,EAAE,IAAA,qCAAiB,EAAC,EAAE,KAAK,EAAE,oBAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,CAAC;KACrE,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,kBAAkB,sBAY7B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UniDuration } from '@ehmpathy/uni-time';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { type UniDuration } from '@ehmpathy/uni-time';
|
|
2
|
+
import type { LogLevel } from '../domain/constants';
|
|
3
|
+
import type { ContextLogTrail } from '../domain/LogTrail';
|
|
4
4
|
/**
|
|
5
5
|
* enables input output logging and tracing for a method
|
|
6
6
|
*
|
|
@@ -21,9 +21,15 @@ export declare const withLogTrail: <TInput, TContext extends ContextLogTrail, TO
|
|
|
21
21
|
* specifies the level to log the trail with
|
|
22
22
|
*
|
|
23
23
|
* note:
|
|
24
|
-
* - defaults to .debug // todo: debug to .trail
|
|
24
|
+
* - defaults input & output logs to level .debug // todo: debug to .trail
|
|
25
|
+
* - defaults error logs to level .warn
|
|
26
|
+
* - error level is only overridable via the object form (to prevent accidental downgrade of error logs)
|
|
25
27
|
*/
|
|
26
|
-
level?: LogLevel |
|
|
28
|
+
level?: LogLevel | {
|
|
29
|
+
input?: LogLevel | undefined;
|
|
30
|
+
output?: LogLevel | undefined;
|
|
31
|
+
error?: LogLevel | undefined;
|
|
32
|
+
} | undefined;
|
|
27
33
|
/**
|
|
28
34
|
* what of the input to log
|
|
29
35
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withLogTrail = void 0;
|
|
4
|
-
const error_fns_1 = require("@ehmpathy/error-fns");
|
|
5
4
|
const uni_time_1 = require("@ehmpathy/uni-time");
|
|
5
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
6
6
|
const type_fns_1 = require("type-fns");
|
|
7
7
|
const noOp = (...input) => input;
|
|
8
8
|
const omitContext = (...input) => input[0]; // standard pattern for args = [input, context]
|
|
@@ -28,12 +28,22 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
28
28
|
const name = logic.name || declaredName || null; // use `\\` since `logic.name` returns `""` for anonymous functions
|
|
29
29
|
// if no name is identifiable, throw an error here to fail fast
|
|
30
30
|
if (!name)
|
|
31
|
-
throw new
|
|
31
|
+
throw new helpful_errors_1.UnexpectedCodePathError('could not identify name for wrapped function');
|
|
32
32
|
// if the name specified does not match the name of the function, throw an error here to fail fast
|
|
33
33
|
if (declaredName && name !== declaredName)
|
|
34
|
-
throw new
|
|
34
|
+
throw new helpful_errors_1.UnexpectedCodePathError('the natural name of the function is different than the declared name', { declaredName, naturalName: name });
|
|
35
|
+
// extract the log levels per operation
|
|
36
|
+
const logLevelInput = (typeof logOptions?.level === 'object'
|
|
37
|
+
? logOptions.level.input
|
|
38
|
+
: logOptions?.level) ?? 'debug';
|
|
39
|
+
const logLevelOutput = (typeof logOptions?.level === 'object'
|
|
40
|
+
? logOptions.level.output
|
|
41
|
+
: logOptions?.level) ?? 'debug';
|
|
42
|
+
const logLevelError =
|
|
43
|
+
// note: error level is only overridable via the object form, to prevent `level: 'info'` from accidentally downgrading error logs
|
|
44
|
+
(typeof logOptions?.level === 'object' ? logOptions.level.error : null) ??
|
|
45
|
+
'warn';
|
|
35
46
|
// extract the log methods
|
|
36
|
-
const logTrailLevel = logOptions?.level ?? 'debug';
|
|
37
47
|
const logInputMethod = logOptions?.input ?? omitContext;
|
|
38
48
|
const logOutputMethod = logOptions?.output ?? noOp;
|
|
39
49
|
const logErrorMethod = logOptions?.error ?? pickErrorMessage;
|
|
@@ -43,7 +53,7 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
43
53
|
// wrap the function
|
|
44
54
|
return (input, context) => {
|
|
45
55
|
// now log the input
|
|
46
|
-
context.log
|
|
56
|
+
context.log[logLevelInput](`${name}.input`, {
|
|
47
57
|
input: logInputMethod(input, context),
|
|
48
58
|
});
|
|
49
59
|
// begin tracking duration
|
|
@@ -60,15 +70,37 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
60
70
|
warn: (message, metadata) => context.log.warn(`${name}.progress: ${message}`, metadata),
|
|
61
71
|
error: (message, metadata) => context.log.error(`${name}.progress: ${message}`, metadata),
|
|
62
72
|
};
|
|
63
|
-
//
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
// define what to do when we have an error
|
|
74
|
+
const logError = (error) => {
|
|
75
|
+
const endTimeInMilliseconds = new Date().getTime();
|
|
76
|
+
const durationInMilliseconds = endTimeInMilliseconds - startTimeInMilliseconds;
|
|
77
|
+
const durationInSeconds = roundToHundredths(durationInMilliseconds / 1e3); // https://stackoverflow.com/a/53970656/3068233
|
|
78
|
+
context.log[logLevelError](`${name}.error`, {
|
|
79
|
+
input: logInputMethod(input, context),
|
|
80
|
+
output: logErrorMethod(error),
|
|
81
|
+
...(durationInSeconds >= durationReportingThresholdInSeconds
|
|
82
|
+
? { duration: `${durationInSeconds} sec` } // only include the duration if the threshold was crossed
|
|
83
|
+
: {}),
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
// now execute the method, wrapped to catch sync errors
|
|
87
|
+
let result;
|
|
88
|
+
try {
|
|
89
|
+
result = logic(input, {
|
|
90
|
+
...context,
|
|
91
|
+
log: logMethodsWithContext,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
// log the error for sync functions that throw
|
|
96
|
+
if (error instanceof Error)
|
|
97
|
+
logError(error);
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
68
100
|
// if the result was a promise, log when that method crosses the reporting threshold, to identify which procedures are slow
|
|
69
101
|
if ((0, type_fns_1.isAPromise)(result)) {
|
|
70
102
|
// define how to log the breach, on breach
|
|
71
|
-
const onDurationBreach = () => context.log[
|
|
103
|
+
const onDurationBreach = () => context.log[logLevelOutput](`${name}.duration.breach`, {
|
|
72
104
|
input: logInputMethod(input, context),
|
|
73
105
|
already: { duration: `${durationReportingThresholdInSeconds} sec` },
|
|
74
106
|
});
|
|
@@ -86,7 +118,7 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
86
118
|
const endTimeInMilliseconds = new Date().getTime();
|
|
87
119
|
const durationInMilliseconds = endTimeInMilliseconds - startTimeInMilliseconds;
|
|
88
120
|
const durationInSeconds = roundToHundredths(durationInMilliseconds / 1e3); // https://stackoverflow.com/a/53970656/3068233
|
|
89
|
-
context.log[
|
|
121
|
+
context.log[logLevelOutput](`${name}.output`, {
|
|
90
122
|
input: logInputMethod(input, context),
|
|
91
123
|
output: logOutputMethod(output),
|
|
92
124
|
...(durationInSeconds >= durationReportingThresholdInSeconds
|
|
@@ -94,19 +126,6 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
|
|
|
94
126
|
: {}),
|
|
95
127
|
});
|
|
96
128
|
};
|
|
97
|
-
// define what to do when we have an error
|
|
98
|
-
const logError = (error) => {
|
|
99
|
-
const endTimeInMilliseconds = new Date().getTime();
|
|
100
|
-
const durationInMilliseconds = endTimeInMilliseconds - startTimeInMilliseconds;
|
|
101
|
-
const durationInSeconds = roundToHundredths(durationInMilliseconds / 1e3); // https://stackoverflow.com/a/53970656/3068233
|
|
102
|
-
context.log[logTrailLevel](`${name}.error`, {
|
|
103
|
-
input: logInputMethod(input, context),
|
|
104
|
-
output: logErrorMethod(error),
|
|
105
|
-
...(durationInSeconds >= durationReportingThresholdInSeconds
|
|
106
|
-
? { duration: `${durationInSeconds} sec` } // only include the duration if the threshold was crossed
|
|
107
|
-
: {}),
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
129
|
// if result is a promise, ensure we log after the output resolves
|
|
111
130
|
if ((0, type_fns_1.isAPromise)(result))
|
|
112
131
|
return result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withLogTrail.js","sourceRoot":"","sources":["../../src/logic/withLogTrail.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"withLogTrail.js","sourceRoot":"","sources":["../../src/logic/withLogTrail.ts"],"names":[],"mappings":";;;AAAA,iDAAsE;AAMtE,mDAAyD;AACzD,uCAAuD;AAMvD,MAAM,IAAI,GAAG,CAAC,GAAG,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC;AACtC,MAAM,WAAW,GAAG,CAAC,GAAG,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,+CAA+C;AAChG,MAAM,gBAAgB,GAAG,CAAC,KAAY,EAAE,EAAE,CAAC,CAAC;IAC1C,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;CAClC,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,+CAA+C;AAEvH,MAAM,iCAAiC,GAAG,OAAO,CAAC,GAAG;KAClD,6BAA6B;IAC9B,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC;IACrD,CAAC,CAAC,IAAA,yBAAc,EAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AAEnC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAC1B,KAAoD,EACpD,EACE,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,UAAU,EACf,QAAQ,GAAG;IACT,SAAS,EAAE,EAAE,YAAY,EAAE,iCAAiC,EAAE;CAC/D,GAiDF,EACa,EAAE;IAChB,8CAA8C;IAC9C,MAAM,IAAI,GAAkB,KAAK,CAAC,IAAI,IAAI,YAAY,IAAI,IAAI,CAAC,CAAC,mEAAmE;IAEnI,+DA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CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC;AA9NW,QAAA,YAAY,gBA8NvB"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "simple-log-methods",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "a simple and opinionated logging library. plays well with aws lambda + cloudwatch.",
|
|
5
|
-
"version": "0.6.
|
|
5
|
+
"version": "0.6.4",
|
|
6
6
|
"repository": "ehmpathy/simple-log-methods",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/simple-log-methods",
|
|
8
8
|
"keywords": [
|
|
@@ -28,19 +28,21 @@
|
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build:ts": "tsc -p ./tsconfig.build.json",
|
|
30
30
|
"commit:with-cli": "npx cz",
|
|
31
|
-
"fix:format:
|
|
32
|
-
"fix:format": "npm run fix:format:
|
|
33
|
-
"fix:lint": "
|
|
31
|
+
"fix:format:biome": "biome check --write src",
|
|
32
|
+
"fix:format": "npm run fix:format:biome",
|
|
33
|
+
"fix:lint": "biome check --write src",
|
|
34
|
+
"fix": "npm run fix:format && npm run fix:lint",
|
|
34
35
|
"build:clean": "rm dist/ -rf",
|
|
35
36
|
"build:compile": "tsc -p ./tsconfig.build.json",
|
|
36
37
|
"build": "npm run build:clean && npm run build:compile",
|
|
37
38
|
"test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose",
|
|
38
|
-
"test:types": "tsc -p ./tsconfig.
|
|
39
|
-
"test:format
|
|
40
|
-
"test:
|
|
41
|
-
"test:
|
|
42
|
-
"test:lint:
|
|
43
|
-
"test:lint": "
|
|
39
|
+
"test:types": "tsc -p ./tsconfig.json --noEmit",
|
|
40
|
+
"test:format": "npm run test:format:biome",
|
|
41
|
+
"test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
|
|
42
|
+
"test:format:biome": "biome format src",
|
|
43
|
+
"test:lint:biome": "biome check src --diagnostic-level=error",
|
|
44
|
+
"test:lint:biome:all": "biome check src",
|
|
45
|
+
"test:lint": "npm run test:lint:biome && npm run test:lint:deps",
|
|
44
46
|
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main')",
|
|
45
47
|
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main')",
|
|
46
48
|
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
|
|
@@ -50,44 +52,46 @@
|
|
|
50
52
|
"prepublish": "npm run build",
|
|
51
53
|
"preversion": "npm run prepush",
|
|
52
54
|
"postversion": "git push origin HEAD --tags --no-verify",
|
|
53
|
-
"
|
|
54
|
-
"prepare
|
|
55
|
+
"prepare:husky": "npx husky install && chmod ug+x .husky/*",
|
|
56
|
+
"prepare": "[ -e .git ] && npm run prepare:husky || exit 0"
|
|
55
57
|
},
|
|
56
58
|
"dependencies": {
|
|
57
59
|
"@ehmpathy/error-fns": "^1.3.7",
|
|
58
60
|
"@ehmpathy/uni-time": "^1.7.4",
|
|
59
61
|
"domain-glossary-procedure": "^1.0.0",
|
|
60
|
-
"
|
|
62
|
+
"domain-objects": "0.31.3",
|
|
63
|
+
"helpful-errors": "1.5.3",
|
|
64
|
+
"type-fns": "1.21.0"
|
|
61
65
|
},
|
|
62
66
|
"devDependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"@commitlint/
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"
|
|
67
|
+
"@biomejs/biome": "2.3.8",
|
|
68
|
+
"@commitlint/cli": "19.5.0",
|
|
69
|
+
"@commitlint/config-conventional": "19.5.0",
|
|
70
|
+
"@swc/core": "1.15.3",
|
|
71
|
+
"@swc/jest": "0.2.39",
|
|
72
|
+
"@tsconfig/node20": "20.1.5",
|
|
73
|
+
"@tsconfig/strictest": "2.0.5",
|
|
74
|
+
"@types/jest": "30.0.0",
|
|
75
|
+
"@types/node": "22.15.21",
|
|
71
76
|
"cz-conventional-changelog": "3.3.0",
|
|
72
|
-
"declapract": "^0.
|
|
73
|
-
"declapract-typescript-ehmpathy": "^0.
|
|
77
|
+
"declapract": "^0.13.0",
|
|
78
|
+
"declapract-typescript-ehmpathy": "^0.43.12",
|
|
79
|
+
"declastruct": "1.5.1",
|
|
80
|
+
"declastruct-github": "1.0.7",
|
|
74
81
|
"depcheck": "1.4.3",
|
|
75
|
-
"
|
|
76
|
-
"eslint-config-airbnb-typescript": "18.0.0",
|
|
77
|
-
"eslint-config-prettier": "8.5.0",
|
|
78
|
-
"eslint-plugin-import": "2.26.0",
|
|
79
|
-
"eslint-plugin-prettier": "4.2.1",
|
|
82
|
+
"esbuild-register": "3.6.0",
|
|
80
83
|
"husky": "8.0.3",
|
|
81
|
-
"jest": "
|
|
82
|
-
"
|
|
84
|
+
"jest": "30.2.0",
|
|
85
|
+
"rhachet": "^1.13.1",
|
|
86
|
+
"rhachet-roles-ehmpathy": "^1.13.3",
|
|
83
87
|
"test-fns": "1.4.2",
|
|
84
|
-
"
|
|
85
|
-
"ts-node": "10.9.2",
|
|
88
|
+
"tsx": "4.20.6",
|
|
86
89
|
"typescript": "5.4.5"
|
|
87
90
|
},
|
|
88
91
|
"config": {
|
|
89
92
|
"commitizen": {
|
|
90
93
|
"path": "./node_modules/cz-conventional-changelog"
|
|
91
94
|
}
|
|
92
|
-
}
|
|
95
|
+
},
|
|
96
|
+
"packageManager": "pnpm@10.24.0"
|
|
93
97
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const __1 = require("..");
|
|
4
|
-
const constants_1 = require("../domain/constants");
|
|
5
|
-
const formatLogContentsForEnvironment_1 = require("./formatLogContentsForEnvironment");
|
|
6
|
-
const identifyEnvironment_1 = require("./identifyEnvironment");
|
|
7
|
-
jest.mock('./identifyEnvironment');
|
|
8
|
-
const identifyEnvironmentMock = identifyEnvironment_1.identifyEnvironment;
|
|
9
|
-
describe('formatMetadataForEnvironment', () => {
|
|
10
|
-
it('should not stringify the contents - but should stringify the metadata - if in the local environment', () => {
|
|
11
|
-
identifyEnvironmentMock.mockReturnValue(constants_1.SupportedEnvironment.LOCAL);
|
|
12
|
-
const metadata = { name: 'bob', likes: ['oranges', 'apples'] };
|
|
13
|
-
const logContents = {
|
|
14
|
-
level: __1.LogLevel.INFO,
|
|
15
|
-
timestamp: new Date().toISOString(),
|
|
16
|
-
message: 'hello world!',
|
|
17
|
-
metadata,
|
|
18
|
-
};
|
|
19
|
-
const formatted = (0, formatLogContentsForEnvironment_1.formatLogContentsForEnvironment)(logContents);
|
|
20
|
-
expect(formatted).toEqual({
|
|
21
|
-
...logContents,
|
|
22
|
-
metadata: JSON.stringify(metadata),
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
it('should stringify the contents in the aws lambda environment', () => {
|
|
26
|
-
identifyEnvironmentMock.mockReturnValue(constants_1.SupportedEnvironment.AWS_LAMBDA);
|
|
27
|
-
const metadata = { name: 'bob', likes: ['oranges', 'apples'] };
|
|
28
|
-
const logContents = {
|
|
29
|
-
level: __1.LogLevel.INFO,
|
|
30
|
-
timestamp: new Date().toISOString(),
|
|
31
|
-
message: 'hello world!',
|
|
32
|
-
metadata,
|
|
33
|
-
};
|
|
34
|
-
const formatted = (0, formatLogContentsForEnvironment_1.formatLogContentsForEnvironment)(logContents);
|
|
35
|
-
expect(formatted).toEqual(JSON.stringify(logContents));
|
|
36
|
-
});
|
|
37
|
-
it('should not stringify the contents nor the metadata if in web browser environment', () => {
|
|
38
|
-
identifyEnvironmentMock.mockReturnValue(constants_1.SupportedEnvironment.WEB_BROWSER);
|
|
39
|
-
const metadata = { name: 'bob', likes: ['oranges', 'apples'] };
|
|
40
|
-
const logContents = {
|
|
41
|
-
level: __1.LogLevel.INFO,
|
|
42
|
-
timestamp: new Date().toISOString(),
|
|
43
|
-
message: 'hello world!',
|
|
44
|
-
metadata,
|
|
45
|
-
};
|
|
46
|
-
const formatted = (0, formatLogContentsForEnvironment_1.formatLogContentsForEnvironment)(logContents);
|
|
47
|
-
expect(formatted).toEqual(logContents);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=formatLogContentsForEnvironment.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatLogContentsForEnvironment.test.js","sourceRoot":"","sources":["../../src/logic/formatLogContentsForEnvironment.test.ts"],"names":[],"mappings":";;AAAA,0BAA8B;AAC9B,mDAA2D;AAC3D,uFAAoF;AACpF,+DAA4D;AAE5D,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnC,MAAM,uBAAuB,GAAG,yCAAgC,CAAC;AAEjE,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,qGAAqG,EAAE,GAAG,EAAE;QAC7G,uBAAuB,CAAC,eAAe,CAAC,gCAAoB,CAAC,KAAK,CAAC,CAAC;QACpE,MAAM,QAAQ,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC/D,MAAM,WAAW,GAAG;YAClB,KAAK,EAAE,YAAQ,CAAC,IAAI;YACpB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,OAAO,EAAE,cAAc;YACvB,QAAQ;SACT,CAAC;QACF,MAAM,SAAS,GAAG,IAAA,iEAA+B,EAAC,WAAW,CAAC,CAAC;QAC/D,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC;YACxB,GAAG,WAAW;YACd,QAA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0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const constants_1 = require("../domain/constants");
|
|
4
|
-
const generateLogMethod_1 = require("./generateLogMethod");
|
|
5
|
-
describe('generateLogMethod', () => {
|
|
6
|
-
beforeEach(() => jest.clearAllMocks());
|
|
7
|
-
it('should generate a method that outputs to console.log if below warn level', () => {
|
|
8
|
-
const spy = jest.spyOn(console, 'log');
|
|
9
|
-
const logError = (0, generateLogMethod_1.generateLogMethod)({
|
|
10
|
-
level: constants_1.LogLevel.INFO,
|
|
11
|
-
minimalLogLevel: constants_1.LogLevel.DEBUG,
|
|
12
|
-
});
|
|
13
|
-
logError('testMessage');
|
|
14
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
15
|
-
});
|
|
16
|
-
it('should generate a method that outputs to console.warn if at or above warn level', () => {
|
|
17
|
-
const spy = jest.spyOn(console, 'warn');
|
|
18
|
-
const logError = (0, generateLogMethod_1.generateLogMethod)({
|
|
19
|
-
level: constants_1.LogLevel.ERROR,
|
|
20
|
-
minimalLogLevel: constants_1.LogLevel.DEBUG,
|
|
21
|
-
});
|
|
22
|
-
logError('testMessage');
|
|
23
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
24
|
-
});
|
|
25
|
-
it('should generate a method that outputs timestamp, level, message, and metadata', () => {
|
|
26
|
-
const spy = jest.spyOn(console, 'warn');
|
|
27
|
-
const logError = (0, generateLogMethod_1.generateLogMethod)({
|
|
28
|
-
level: constants_1.LogLevel.ERROR,
|
|
29
|
-
minimalLogLevel: constants_1.LogLevel.DEBUG,
|
|
30
|
-
});
|
|
31
|
-
logError('testMessage', { nested: { object: true } });
|
|
32
|
-
expect(spy).toHaveBeenCalledTimes(1);
|
|
33
|
-
expect(spy).toHaveBeenCalledWith(expect.objectContaining({
|
|
34
|
-
level: constants_1.LogLevel.ERROR,
|
|
35
|
-
message: 'testMessage',
|
|
36
|
-
metadata: JSON.stringify({ nested: { object: true } }),
|
|
37
|
-
}));
|
|
38
|
-
expect(spy.mock.calls[0][0]).toHaveProperty('timestamp');
|
|
39
|
-
});
|
|
40
|
-
it('should not output anything if level is below minimum', () => {
|
|
41
|
-
const spy = jest.spyOn(console, 'log');
|
|
42
|
-
const logDebug = (0, generateLogMethod_1.generateLogMethod)({
|
|
43
|
-
level: constants_1.LogLevel.DEBUG,
|
|
44
|
-
minimalLogLevel: constants_1.LogLevel.WARN,
|
|
45
|
-
});
|
|
46
|
-
logDebug('testMessage');
|
|
47
|
-
expect(spy).not.toHaveBeenCalled();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=generateLogMethod.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateLogMethod.test.js","sourceRoot":"","sources":["../../src/logic/generateLogMethod.test.ts"],"names":[],"mappings":";;AAAA,mDAA+C;AAC/C,2DAAwD;AAExD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IACvC,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;QAClF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC;YACjC,KAAK,EAAE,oBAAQ,CAAC,IAAI;YACpB,eAAe,EAAE,oBAAQ,CAAC,KAAK;SAChC,CAAC,CAAC;QACH,QAAQ,CAAC,aAAa,CAAC,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iFAAiF,EAAE,GAAG,EAAE;QACzF,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EA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O,EAAE,KAAK,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC;YACjC,KAAK,EAAE,oBAAQ,CAAC,KAAK;YACrB,eAAe,EAAE,oBAAQ,CAAC,IAAI;SAC/B,CAAC,CAAC;QACH,QAAQ,CAAC,aAAa,CAAC,CAAC;QACxB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const generateLogMethods_1 = require("./generateLogMethods");
|
|
4
|
-
describe('generateLogMethods', () => {
|
|
5
|
-
it('should create the log methods', () => {
|
|
6
|
-
const log = (0, generateLogMethods_1.generateLogMethods)();
|
|
7
|
-
expect(log).toHaveProperty('error');
|
|
8
|
-
expect(log).toHaveProperty('warn');
|
|
9
|
-
expect(log).toHaveProperty('info');
|
|
10
|
-
expect(log).toHaveProperty('debug');
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=generateLogMethods.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateLogMethods.test.js","sourceRoot":"","sources":["../../src/logic/generateLogMethods.test.ts"],"names":[],"mappings":";;AAAA,6DAA0D;AAE1D,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,GAAG,GAAG,IAAA,uCAAkB,GAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|