simple-log-methods 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { LogLevel } from '../domain/constants';
2
- export type LogMethod = (message: string, metadata: any) => void;
2
+ export type LogMethod = (message: string, metadata?: any) => void;
3
3
  export declare const generateLogMethod: ({ level, minimalLogLevel, }: {
4
4
  level: LogLevel;
5
5
  minimalLogLevel: LogLevel;
@@ -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 | undefined;
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
  */
@@ -32,8 +32,18 @@ const withLogTrail = (logic, { name: declaredName, log: logOptions, duration = {
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
34
  throw new error_fns_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.debug(`${name}.input`, {
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
- // now execute the method
64
- const result = logic(input, {
65
- ...context,
66
- log: logMethodsWithContext,
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[logTrailLevel](`${name}.duration.breach`, {
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[logTrailLevel](`${name}.output`, {
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,mDAA8D;AAC9D,iDAAiE;AAMjE,uCAAkD;AAOlD,MAAM,IAAI,GAAG,CAAC,GAAG,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC;AACtC,MAAM,WAAW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ACtB,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAChB,MAAM,KAAK,CAAC;YACd,CAAC,CAAY,CAAC;QAElB,8EAA8E;QAC9E,SAAS,CAAC,MAAgD,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC;AA9NW,QAAA,YAAY,gBA8NvB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const constants_1 = require("../domain/constants");
4
+ const withLogTrail_1 = require("./withLogTrail");
5
+ const createMockLogMethods = () => ({
6
+ debug: jest.fn(),
7
+ info: jest.fn(),
8
+ warn: jest.fn(),
9
+ error: jest.fn(),
10
+ });
11
+ describe('withLogTrail', () => {
12
+ beforeEach(() => jest.clearAllMocks());
13
+ describe('log.level', () => {
14
+ describe('default behavior (no level specified)', () => {
15
+ it('should use debug level for input logging', () => {
16
+ const mockLog = createMockLogMethods();
17
+ const testFn = function testFunction(input) {
18
+ return input.toUpperCase();
19
+ };
20
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {});
21
+ wrapped('hello', { log: mockLog });
22
+ expect(mockLog.debug).toHaveBeenCalledWith('testFunction.input', expect.any(Object));
23
+ });
24
+ it('should use debug level for output logging', () => {
25
+ const mockLog = createMockLogMethods();
26
+ const testFn = function testFunction(input) {
27
+ return input.toUpperCase();
28
+ };
29
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {});
30
+ wrapped('hello', { log: mockLog });
31
+ expect(mockLog.debug).toHaveBeenCalledWith('testFunction.output', expect.any(Object));
32
+ });
33
+ it('should use warn level for error logging', () => {
34
+ const mockLog = createMockLogMethods();
35
+ const testFn = function testFunction(_input) {
36
+ throw new Error('test error');
37
+ };
38
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {});
39
+ expect(() => wrapped('hello', { log: mockLog })).toThrow('test error');
40
+ expect(mockLog.warn).toHaveBeenCalledWith('testFunction.error', expect.any(Object));
41
+ });
42
+ });
43
+ describe('single level specified', () => {
44
+ it('should use the specified level for input logging', () => {
45
+ const mockLog = createMockLogMethods();
46
+ const testFn = function testFunction(input) {
47
+ return input.toUpperCase();
48
+ };
49
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, { log: { level: constants_1.LogLevel.INFO } });
50
+ wrapped('hello', { log: mockLog });
51
+ expect(mockLog.info).toHaveBeenCalledWith('testFunction.input', expect.any(Object));
52
+ expect(mockLog.debug).not.toHaveBeenCalled();
53
+ });
54
+ it('should use the specified level for output logging', () => {
55
+ const mockLog = createMockLogMethods();
56
+ const testFn = function testFunction(input) {
57
+ return input.toUpperCase();
58
+ };
59
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, { log: { level: constants_1.LogLevel.INFO } });
60
+ wrapped('hello', { log: mockLog });
61
+ expect(mockLog.info).toHaveBeenCalledWith('testFunction.output', expect.any(Object));
62
+ });
63
+ it('should not allow single level to downgrade error logging from warn', () => {
64
+ const mockLog = createMockLogMethods();
65
+ const testFn = function testFunction(_input) {
66
+ throw new Error('test error');
67
+ };
68
+ // even though we specify INFO level, error logs should remain at WARN
69
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, { log: { level: constants_1.LogLevel.INFO } });
70
+ expect(() => wrapped('hello', { log: mockLog })).toThrow('test error');
71
+ expect(mockLog.warn).toHaveBeenCalledWith('testFunction.error', expect.any(Object));
72
+ expect(mockLog.info).not.toHaveBeenCalledWith('testFunction.error', expect.any(Object));
73
+ });
74
+ it('should not allow single debug level to downgrade error logging from warn', () => {
75
+ const mockLog = createMockLogMethods();
76
+ const testFn = function testFunction(_input) {
77
+ throw new Error('test error');
78
+ };
79
+ // even though we specify DEBUG level, error logs should remain at WARN
80
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
81
+ log: { level: constants_1.LogLevel.DEBUG },
82
+ });
83
+ expect(() => wrapped('hello', { log: mockLog })).toThrow('test error');
84
+ expect(mockLog.warn).toHaveBeenCalledWith('testFunction.error', expect.any(Object));
85
+ expect(mockLog.debug).not.toHaveBeenCalledWith('testFunction.error', expect.any(Object));
86
+ });
87
+ });
88
+ describe('object with individual levels', () => {
89
+ it('should use the specified input level', () => {
90
+ const mockLog = createMockLogMethods();
91
+ const testFn = function testFunction(input) {
92
+ return input.toUpperCase();
93
+ };
94
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
95
+ log: { level: { input: constants_1.LogLevel.INFO } },
96
+ });
97
+ wrapped('hello', { log: mockLog });
98
+ expect(mockLog.info).toHaveBeenCalledWith('testFunction.input', expect.any(Object));
99
+ });
100
+ it('should use the specified output level', () => {
101
+ const mockLog = createMockLogMethods();
102
+ const testFn = function testFunction(input) {
103
+ return input.toUpperCase();
104
+ };
105
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
106
+ log: { level: { output: constants_1.LogLevel.WARN } },
107
+ });
108
+ wrapped('hello', { log: mockLog });
109
+ expect(mockLog.warn).toHaveBeenCalledWith('testFunction.output', expect.any(Object));
110
+ });
111
+ it('should use the specified error level', () => {
112
+ const mockLog = createMockLogMethods();
113
+ const testFn = function testFunction(_input) {
114
+ throw new Error('test error');
115
+ };
116
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
117
+ log: { level: { error: constants_1.LogLevel.ERROR } },
118
+ });
119
+ expect(() => wrapped('hello', { log: mockLog })).toThrow('test error');
120
+ expect(mockLog.error).toHaveBeenCalledWith('testFunction.error', expect.any(Object));
121
+ });
122
+ it('should allow specifying different levels for each operation', () => {
123
+ const mockLog = createMockLogMethods();
124
+ const testFn = function testFunction(input) {
125
+ return input.toUpperCase();
126
+ };
127
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
128
+ log: {
129
+ level: {
130
+ input: constants_1.LogLevel.DEBUG,
131
+ output: constants_1.LogLevel.INFO,
132
+ error: constants_1.LogLevel.ERROR,
133
+ },
134
+ },
135
+ });
136
+ wrapped('hello', { log: mockLog });
137
+ expect(mockLog.debug).toHaveBeenCalledWith('testFunction.input', expect.any(Object));
138
+ expect(mockLog.info).toHaveBeenCalledWith('testFunction.output', expect.any(Object));
139
+ });
140
+ it('should default to debug for input when not specified in object', () => {
141
+ const mockLog = createMockLogMethods();
142
+ const testFn = function testFunction(input) {
143
+ return input.toUpperCase();
144
+ };
145
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
146
+ log: { level: { output: constants_1.LogLevel.INFO } },
147
+ });
148
+ wrapped('hello', { log: mockLog });
149
+ expect(mockLog.debug).toHaveBeenCalledWith('testFunction.input', expect.any(Object));
150
+ });
151
+ it('should default to debug for output when not specified in object', () => {
152
+ const mockLog = createMockLogMethods();
153
+ const testFn = function testFunction(input) {
154
+ return input.toUpperCase();
155
+ };
156
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
157
+ log: { level: { input: constants_1.LogLevel.INFO } },
158
+ });
159
+ wrapped('hello', { log: mockLog });
160
+ expect(mockLog.debug).toHaveBeenCalledWith('testFunction.output', expect.any(Object));
161
+ });
162
+ it('should default to warn for error when not specified in object', () => {
163
+ const mockLog = createMockLogMethods();
164
+ const testFn = function testFunction(_input) {
165
+ throw new Error('test error');
166
+ };
167
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
168
+ log: { level: { input: constants_1.LogLevel.INFO, output: constants_1.LogLevel.INFO } },
169
+ });
170
+ expect(() => wrapped('hello', { log: mockLog })).toThrow('test error');
171
+ expect(mockLog.warn).toHaveBeenCalledWith('testFunction.error', expect.any(Object));
172
+ });
173
+ });
174
+ describe('async functions', () => {
175
+ it('should use specified levels for async function input', async () => {
176
+ const mockLog = createMockLogMethods();
177
+ const testFn = async function testAsyncFunction(input) {
178
+ return input.toUpperCase();
179
+ };
180
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
181
+ log: { level: { input: constants_1.LogLevel.INFO } },
182
+ });
183
+ await wrapped('hello', { log: mockLog });
184
+ expect(mockLog.info).toHaveBeenCalledWith('testAsyncFunction.input', expect.any(Object));
185
+ });
186
+ it('should use specified levels for async function output', async () => {
187
+ const mockLog = createMockLogMethods();
188
+ const testFn = async function testAsyncFunction(input) {
189
+ return input.toUpperCase();
190
+ };
191
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
192
+ log: { level: { output: constants_1.LogLevel.INFO } },
193
+ });
194
+ await wrapped('hello', { log: mockLog });
195
+ expect(mockLog.info).toHaveBeenCalledWith('testAsyncFunction.output', expect.any(Object));
196
+ });
197
+ it('should use specified levels for async function error', async () => {
198
+ const mockLog = createMockLogMethods();
199
+ const testFn = async function testAsyncFunction(_input) {
200
+ throw new Error('async test error');
201
+ };
202
+ const wrapped = (0, withLogTrail_1.withLogTrail)(testFn, {
203
+ log: { level: { error: constants_1.LogLevel.ERROR } },
204
+ });
205
+ await expect(wrapped('hello', { log: mockLog })).rejects.toThrow('async test error');
206
+ expect(mockLog.error).toHaveBeenCalledWith('testAsyncFunction.error', expect.any(Object));
207
+ });
208
+ });
209
+ });
210
+ });
211
+ //# sourceMappingURL=withLogTrail.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withLogTrail.test.js","sourceRoot":"","sources":["../../src/logic/withLogTrail.test.ts"],"names":[],"mappings":";;AAAA,mDAA+C;AAE/C,iDAA8C;AAE9C,MAAM,oBAAoB,GAAG,GAK3B,EAAE,CAAC,CAAC;IACJ,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;IAChB,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;IACf,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE;IACf,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;CACjB,CAAC,CAAC;AAEH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAEvC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,QAAQ,C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AC;AACL,CAAC,CAAC,CAAC"}
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.1",
5
+ "version": "0.6.3",
6
6
  "repository": "ehmpathy/simple-log-methods",
7
7
  "homepage": "https://github.com/ehmpathy/simple-log-methods",
8
8
  "keywords": [
@@ -80,6 +80,8 @@
80
80
  "husky": "8.0.3",
81
81
  "jest": "29.3.1",
82
82
  "prettier": "2.8.1",
83
+ "rhachet": "^1.13.1",
84
+ "rhachet-roles-ehmpathy": "^1.13.3",
83
85
  "test-fns": "1.4.2",
84
86
  "ts-jest": "29.1.3",
85
87
  "ts-node": "10.9.2",