@vvlad1973/simple-logger 1.2.1 → 2.0.1

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/README.md +91 -41
  3. package/dist/__test__/simple-logger.test.js +54 -101
  4. package/dist/__test__/simple-logger.test.js.map +1 -1
  5. package/dist/classes/simple-logger.d.ts +125 -0
  6. package/dist/classes/simple-logger.js +290 -0
  7. package/dist/classes/simple-logger.js.map +1 -0
  8. package/dist/constants/constants.d.ts +9 -0
  9. package/dist/constants/constants.js +10 -0
  10. package/dist/constants/constants.js.map +1 -0
  11. package/dist/helpers/helpers.d.ts +31 -0
  12. package/dist/helpers/helpers.js +81 -0
  13. package/dist/helpers/helpers.js.map +1 -0
  14. package/dist/helpers/validators.d.ts +17 -0
  15. package/dist/helpers/validators.js +27 -0
  16. package/dist/helpers/validators.js.map +1 -0
  17. package/dist/index.d.ts +5 -2
  18. package/dist/index.js +5 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/types/simple-logger.types.d.ts +27 -0
  21. package/dist/types/simple-logger.types.js +2 -0
  22. package/dist/types/simple-logger.types.js.map +1 -0
  23. package/docs/assets/highlight.css +9 -2
  24. package/docs/assets/navigation.js +1 -1
  25. package/docs/assets/search.js +1 -1
  26. package/docs/classes/SimpleLogger.html +27 -15
  27. package/docs/index.html +52 -23
  28. package/docs/interfaces/ExternalLogger.html +10 -0
  29. package/docs/interfaces/LogFn.html +1 -0
  30. package/docs/interfaces/LoggerOptions.html +5 -0
  31. package/docs/modules.html +1 -1
  32. package/docs/types/LoggerFactory.html +1 -0
  33. package/docs/types/LoggerLevel.html +1 -1
  34. package/docs/types/PreparedLogCall.html +1 -0
  35. package/docs/variables/LoggerLevels.html +1 -0
  36. package/package.json +20 -7
  37. package/src/__test__/simple-logger.test.ts +67 -55
  38. package/src/classes/simple-logger.ts +354 -0
  39. package/src/constants/constants.ts +9 -0
  40. package/src/helpers/helpers.ts +92 -0
  41. package/src/helpers/validators.ts +36 -0
  42. package/src/index.ts +7 -2
  43. package/src/types/simple-logger.types.ts +40 -0
  44. package/docs/types/ExternalLogger.html +0 -1
  45. package/src/simple-logger.ts +0 -190
package/CHANGELOG.md ADDED
@@ -0,0 +1,143 @@
1
+ # Changelog
2
+
3
+ ## [2.0.1](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v2.0.0...v2.0.1)
4
+
5
+ ### Documentation
6
+
7
+ - **docs**: Documentation has been updated (2025-05-04) [`b902f966507fe2e114ba4021e67ce011b24566fb`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/b902f966507fe2e114ba4021e67ce011b24566fb)
8
+
9
+ ## [2.0.0](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.2.2...v2.0.0)
10
+
11
+ ### ⚠️ Breaking Changes
12
+
13
+ - **feat**: Added .child() method, support creating child instances of logger with different bindings and message prefixes (2025-05-04) [`2f9591c48007bc29e441c32fc1480353a691ec47`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/2f9591c48007bc29e441c32fc1480353a691ec47)
14
+
15
+ Changed signature of constructor of the class
16
+
17
+ ### Documentation
18
+
19
+ - **docs**: Documentation has been updated (2025-05-04) [`7599a27dc0a31f1418ee920cb8d341f16c062334`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/7599a27dc0a31f1418ee920cb8d341f16c062334)
20
+
21
+ Changed signature of constructor of the class
22
+
23
+ ## [1.2.2](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.2.1...v1.2.2)
24
+
25
+ ### Documentation
26
+
27
+ - **docs**: Docs updated (2025-03-03) [`ec39cdecd7e2c8b7b070e301c89ed492779f235c`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/ec39cdecd7e2c8b7b070e301c89ed492779f235c)
28
+
29
+ ## [1.2.1](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.2.0...v1.2.1)
30
+
31
+ ### Documentation
32
+
33
+ - **docs**: Moved to TypeDoc, generated docs (2025-03-03) [`ca09fad9642b2a2327f133cb360432d87ae588a9`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/ca09fad9642b2a2327f133cb360432d87ae588a9)
34
+
35
+ ## [1.2.0](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.29...v1.2.0)
36
+
37
+ ### Features
38
+
39
+ - **feat**(SimpleLogger): Added property isExternal (2024-08-06) [`06432b0bd0454f0297bbbb6886e9174d3cdfc7ab`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/06432b0bd0454f0297bbbb6886e9174d3cdfc7ab)
40
+
41
+ ## [1.1.29](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.28...v1.1.29)
42
+
43
+ ### Fixes
44
+
45
+ - **fix**(setExternalLogger()): Fixed bug with initialize log level (2024-07-28) [`4e678c4479e84ec11ffd34d505ff2e16c8d4b72e`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/4e678c4479e84ec11ffd34d505ff2e16c8d4b72e)
46
+
47
+ ## [1.1.27](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.26...v1.1.27)
48
+
49
+ ### Features
50
+
51
+ - **feat**: Add export LoggerLevel type (2024-07-28) [`51f2f44f1b7979ad3539e72b06d2c3ce76e94c6d`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/51f2f44f1b7979ad3539e72b06d2c3ce76e94c6d)
52
+
53
+ ## [1.1.25](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.24...v1.1.25)
54
+
55
+ ### Fixes
56
+
57
+ - **fix**(constructor): Changed initialization of level logging when the object creating (2024-07-28) [`2f0a7979fe30098bf2a211ead265fa09d770b4cf`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/2f0a7979fe30098bf2a211ead265fa09d770b4cf)
58
+
59
+ ## [1.1.24](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.23...v1.1.24)
60
+
61
+ ### Fixes
62
+
63
+ - **fix**(constructor): Changed initialization of level logging when the object creating (2024-07-28) [`85a8e9de3dd15fe18ede74c2654f39d9256095c5`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/85a8e9de3dd15fe18ede74c2654f39d9256095c5)
64
+
65
+ ## [1.1.23](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.22...v1.1.23)
66
+
67
+ ### Fixes
68
+
69
+ - **fix**(constructor): Changed initialization of level logging when the object creating (2024-07-28) [`cd9649314135f2e5f403a01372f19c13c6c94057`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/cd9649314135f2e5f403a01372f19c13c6c94057)
70
+
71
+ ## [1.1.21](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.20...v1.1.21)
72
+
73
+ ### Fixes
74
+
75
+ - **fix**(simple-logger.ys): Fixed bug in .setLevel() (2024-07-19) [`26a26901491fede98508d195612dacf6ab8dc694`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/26a26901491fede98508d195612dacf6ab8dc694)
76
+
77
+ ## [1.1.20](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.19...v1.1.20)
78
+
79
+ ### Fixes
80
+
81
+ - **fix**(simple-logger.ts): Fixed settings log level (2024-07-19) [`f50f4530b61e230a93d6e55a1c573ddbf8bd549e`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/f50f4530b61e230a93d6e55a1c573ddbf8bd549e)
82
+
83
+ ## [1.1.19](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.18...v1.1.19)
84
+
85
+ ### Fixes
86
+
87
+ - **fix**(simple-logger.ts): Fixed settings log level (2024-07-19) [`7e9f06b6b91f800727f1dd13e38cbb5ea578775a`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/7e9f06b6b91f800727f1dd13e38cbb5ea578775a)
88
+
89
+ ## [1.1.18](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.17...v1.1.18)
90
+
91
+ ### Fixes
92
+
93
+ - **fix**(simple-logger.ts): Fixed settings log level (2024-07-19) [`9027c4231b36998d32afd1b03c81a32828b2c91a`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/9027c4231b36998d32afd1b03c81a32828b2c91a)
94
+
95
+ ## [1.1.16](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.15...v1.1.16)
96
+
97
+ ### Fixes
98
+
99
+ - **fix**(simple-logger.ts): Fixed settings log level (2024-07-19) [`3af08379e662e9df7fbe89bf0b85d482efa83bf3`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/3af08379e662e9df7fbe89bf0b85d482efa83bf3)
100
+
101
+ ## [1.1.14](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.13...v1.1.14)
102
+
103
+ ### Fixes
104
+
105
+ - **fix**(simple-logger.ts): Fixed bug with set log lever for external logger (2024-07-18) [`a3a945b4220997611b706dd1ca7ef33bfbc2efd7`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/a3a945b4220997611b706dd1ca7ef33bfbc2efd7)
106
+
107
+ ## [1.1.13](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.12...v1.1.13)
108
+
109
+ ### Fixes
110
+
111
+ - **fix**(simple-logger.ts): Fixed bug with set log lever for external logger (2024-07-18) [`2f181e8d5ed4590411242896f7eda0709f4039df`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/2f181e8d5ed4590411242896f7eda0709f4039df)
112
+
113
+ ## [1.1.11](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.10...v1.1.11)
114
+
115
+ ### Fixes
116
+
117
+ - **fix**(simple-logger.ts): Delete debug console output messages (2024-07-05) [`fe98428c8393166e52c0bd9a60aeefb6a88d4f2c`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/fe98428c8393166e52c0bd9a60aeefb6a88d4f2c)
118
+
119
+ ## [1.1.10](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.9...v1.1.10)
120
+
121
+ ### Fixes
122
+
123
+ - **fix**(.getExternalLoggerMethod()): Minor fix debug info (2024-07-05) [`e81c536a567453e8404d3bb2e24a68e1f6c5ea2d`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/e81c536a567453e8404d3bb2e24a68e1f6c5ea2d)
124
+
125
+ ## [1.1.9](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.8...v1.1.9)
126
+
127
+ ### Fixes
128
+
129
+ - **fix**(.getExternalLoggerMethod()): Fixed console out (2024-07-05) [`d67ba19d547265bb78f3d8ad7dbc39a1ffdfe8ad`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/d67ba19d547265bb78f3d8ad7dbc39a1ffdfe8ad)
130
+
131
+ ## [1.1.8](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.7...v1.1.8)
132
+
133
+ ### Features
134
+
135
+ - **feat**(SimpleLogger): Added possibility to set fallback logging method in internal method .getExternalLoggerMethod# (2024-07-05) [`1b5d6dd74ace8a2daba95f0536ebbc6a3f18f7a7`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/1b5d6dd74ace8a2daba95f0536ebbc6a3f18f7a7)
136
+
137
+ Added private notation to #
138
+
139
+ ## [1.1.6](https://github.com/vvlad1973/vvlad1973-simple-logger/compare/v1.1.5...v1.1.6)
140
+
141
+ ### Fixes
142
+
143
+ - **fix**(index.ts): Fixed exports (2024-07-05) [`7441a0a0c7ffd0cfa802c43060996221060bab03`](https://github.com/vvlad1973/vvlad1973-simple-logger/commit/7441a0a0c7ffd0cfa802c43060996221060bab03)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vvlad1973/simple-logger
2
2
 
3
- A simple logger module for Node.js applications with support for various logging levels.
3
+ A flexible and lightweight logger for Node.js with support for custom levels, bindings, child loggers, and external loggers like Pino.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,88 +10,138 @@ npm install @vvlad1973/simple-logger
10
10
 
11
11
  ## Features
12
12
 
13
- - Supports logging at different levels: TRACE, DEBUG, INFO, WARN, ERROR, FATAL.
14
- - Allows integration with external logging libraries like Pino.
13
+ - Log levels: trace, debug, info, warn, error, fatal, silent
14
+ - Pretty-printed logs to console
15
+ - Optional bindings/context injection (e.g. userId, requestId)
16
+ - Optional msgPrefix
17
+ - Integration with external loggers (e.g. Pino) or logger factories
18
+ - Automatic detection of external logger .child() support
19
+ - Supports creating child loggers with merged context
20
+ - Function entry/exit logging
15
21
 
16
22
  ## Usage
17
23
 
18
- ### Simple Logger
19
-
20
- ```javascript
24
+ ### Basic usage
21
25
 
26
+ ```ts
22
27
  import SimpleLogger from '@vvlad1973/simple-logger';
23
28
 
24
- const logger = new SimpleLogger('DEBUG');
29
+ const logger = new SimpleLogger(null, {
30
+ level: 'debug',
31
+ msgPrefix: '[MyApp]',
32
+ bindings: { service: 'auth' },
33
+ });
25
34
 
26
35
  logger.debug('Debug message');
27
- logger.info('Info message');
28
- logger.warn('Warning message');
29
- logger.error('Error message');
30
- logger.fatal('Fatal error message');
36
+ logger.info({ userId: 123 }, 'User logged in');
37
+ logger.warn('Something might be wrong');
38
+ logger.error('Something is wrong');
39
+ logger.fatal('System failure');
31
40
  ```
32
41
 
33
42
  ### Integration with Pino
34
43
 
35
- ```javascript
44
+ ```ts
36
45
  import pino from 'pino';
37
46
  import SimpleLogger from '@vvlad1973/simple-logger';
38
47
 
39
- // Initialize Pino logger
40
48
  const pinoLogger = pino({
41
- prettyPrint: true,
49
+ level: 'info'
42
50
  });
43
51
 
44
- // Use Pino logger with SimpleLogger
45
- const logger = new SimpleLogger('DEBUG', pinoLogger);
52
+ const logger = new SimpleLogger(pinoLogger, {
53
+ bindings: { component: 'api' },
54
+ msgPrefix: '[API]',
55
+ }); // this will create child logger with merged bindings
46
56
 
47
- logger.debug('Debug message');
48
- logger.info('Info message');
49
- logger.warn('Warning message');
50
- logger.error('Error message');
51
- logger.fatal('Fatal error message');
57
+ logger.info({ userId: 42 }, 'User fetched');
58
+ ```
59
+
60
+ Or you can use a factory function:
61
+
62
+ ```ts
63
+ import pino from 'pino';
64
+ import SimpleLogger from '@vvlad1973/simple-logger';
65
+
66
+ const logger = new SimpleLogger(pino, {
67
+ bindings: { component: 'api' },
68
+ msgPrefix: '[API]',
69
+ });
70
+
71
+ logger.info({ userId: 42 }, 'User fetched');
52
72
  ```
53
73
 
54
74
  ## API
55
75
 
56
- ### new SimpleLogger(level, externalLogger)
76
+ ### new SimpleLogger(externalLogger?: ExternalLogger | LoggerFactory, options?: LoggerOptions)
57
77
 
58
- Creates a new instance of SimpleLogger.
78
+ Creates a new logger instance.
59
79
 
60
- - level (optional): Initial logging level. Defaults to 'INFO'.
61
- - externalLogger (optional): External logger instance. Can be an object with methods (trace, debug, info, warn, error, fatal) or any other logger compatible with these methods.
80
+ Parameters:
62
81
 
63
- ### setLevel(level)
82
+ - externalLogger – optional:
64
83
 
65
- Sets the logging level of the logger instance.
84
+ - An existing logger instance (pino, winston, etc.)
85
+ - A factory function (e.g. pino)
66
86
 
67
- - level: The logging level to set ('TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL').
87
+ - options optional:
68
88
 
69
- ### setExternalLogger(logger)
89
+ - level: Logging level
90
+ - bindings: Default context
91
+ - msgPrefix: Prefix for messages
92
+ - transport: Optional transport (used if logger is a factory)
70
93
 
71
- Sets an external logger instance to be used by SimpleLogger.
94
+ ### logger.setLevel(level: LoggerLevel)
72
95
 
73
- - logger: External logger instance. Should be an object with methods (trace, debug, info, warn, error, fatal) or any other logger compatible with these methods.
96
+ Sets the logging level.
74
97
 
75
- ### logFunctionStart(functionName?)
98
+ ### logger.getLevel(): LoggerLevel
76
99
 
77
- Logs the start of a function.
100
+ Returns the current log level.
78
101
 
79
- - functionName (optional): Name of the function to log. If not provided, attempts to retrieve the caller function name.
102
+ ### logger.setExternalLogger(externalLogger, options?)
80
103
 
81
- ### logFunctionEnd(functionName?)
104
+ Replace the underlying logger with a new one and optionally provide options for bindings, prefix, etc.
105
+
106
+ ### logger.child(bindings: Record<string, unknown>): SimpleLogger
107
+
108
+ Creates a child logger with merged bindings.
109
+
110
+ ### logger.logFunctionStart(name?: string)
111
+
112
+ Logs the beginning of a function.
113
+
114
+ ### logger.logFunctionEnd(name?: string)
82
115
 
83
116
  Logs the end of a function.
84
117
 
85
- - functionName (optional): Name of the function to log. If not provided, attempts to retrieve the caller function name.
118
+ ### Logging methods
119
+
120
+ Each of the following is available as a method:
121
+
122
+ - trace
123
+ - debug
124
+ - info
125
+ - warn
126
+ - error
127
+ - fatal
128
+ - silent (noop)
129
+
130
+ Each method accepts:
131
+
132
+ ```ts
133
+ logger.info(message: string, ...args: unknown[]);
134
+ logger.info(context: object, message?: string, ...args: unknown[]);
135
+ ```
86
136
 
87
- ### Documentation
137
+ ## Documentation
88
138
 
89
- Full information about the package is available in the [./docs](./docs/index.html) directory
139
+ More details are available in the ./docs directory.
90
140
 
91
- ### License
141
+ ## License
92
142
 
93
- This project is licensed under the MIT License with Commercial Use.
143
+ MIT License (including commercial use)
94
144
 
95
145
  ## Author
96
146
 
97
- Vladislav Vnukovskiy <vvlad1973@gmail.com>
147
+ Vladislav Vnukovskiy <[vvlad1973@gmail.com](mailto:vvlad1973@gmail.com)>
@@ -1,113 +1,66 @@
1
- import { describe, it, beforeEach } from 'node:test';
2
- import assert from 'assert';
3
- import SimpleLogger from '../simple-logger.js';
4
- function createMockLoggerMethod() {
5
- const calls = [];
6
- const mockFn = function (...args) {
7
- calls.push(args);
8
- };
9
- mockFn.mock = { calls };
10
- return mockFn;
11
- }
12
- function createNoopMethod() {
13
- const calls = [];
14
- const mockFn = function (...args) { };
15
- mockFn.mock = { calls };
16
- return mockFn;
17
- }
18
- function createExternalLoggerMock() {
19
- return {
20
- trace: createMockLoggerMethod(),
21
- debug: createMockLoggerMethod(),
22
- info: createMockLoggerMethod(),
23
- warn: createMockLoggerMethod(),
24
- error: createMockLoggerMethod(),
25
- fatal: createMockLoggerMethod(),
26
- silent: createMockLoggerMethod(),
27
- };
28
- }
1
+ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
+ import SimpleLogger from '../classes/simple-logger.js';
29
3
  describe('SimpleLogger', () => {
30
- let logger;
31
- let externalLoggerMock;
4
+ let consoleSpy;
32
5
  beforeEach(() => {
33
- externalLoggerMock = createExternalLoggerMock();
34
- logger = new SimpleLogger('info', externalLoggerMock);
6
+ consoleSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
35
7
  });
36
- it('should call external logger methods appropriately', () => {
37
- logger.trace('trace message');
38
- logger.debug('debug message');
39
- logger.info('info message');
40
- logger.warn('warn message');
41
- logger.error('error message');
42
- logger.fatal('fatal message');
43
- assert.strictEqual(externalLoggerMock.trace.mock.calls.length, 0);
44
- assert.strictEqual(externalLoggerMock.debug.mock.calls.length, 0);
45
- assert.strictEqual(externalLoggerMock.info.mock.calls.length, 1);
46
- assert.strictEqual(externalLoggerMock.info.mock.calls[0][0], 'info message');
47
- assert.strictEqual(externalLoggerMock.warn.mock.calls.length, 1);
48
- assert.strictEqual(externalLoggerMock.warn.mock.calls[0][0], 'warn message');
49
- assert.strictEqual(externalLoggerMock.error.mock.calls.length, 1);
50
- assert.strictEqual(externalLoggerMock.error.mock.calls[0][0], 'error message');
51
- assert.strictEqual(externalLoggerMock.fatal.mock.calls.length, 1);
52
- assert.strictEqual(externalLoggerMock.fatal.mock.calls[0][0], 'fatal message');
8
+ afterEach(() => {
9
+ consoleSpy.mockRestore();
53
10
  });
54
- it('should log function start and end', () => {
55
- logger.setLevel('TRACE');
56
- function testFunction() {
57
- logger.logFunctionStart();
58
- logger.logFunctionEnd();
59
- }
60
- testFunction();
61
- assert.strictEqual(externalLoggerMock.trace.mock.calls.length, 2);
62
- assert.strictEqual(externalLoggerMock.trace.mock.calls[0][0], 'Function start: testFunction');
63
- assert.strictEqual(externalLoggerMock.trace.mock.calls[1][0], 'Function end: testFunction');
11
+ it('should log using console when no external logger is provided', () => {
12
+ const logger = new SimpleLogger();
13
+ logger.info('test message');
14
+ expect(consoleSpy).toHaveBeenCalledOnce();
15
+ expect(consoleSpy.mock.calls[0][0]).toMatch(/test message/);
64
16
  });
65
- });
66
- describe('SimpleLogger2', () => {
67
- let logger;
68
- let externalLoggerMock;
69
- beforeEach(() => {
70
- externalLoggerMock = createExternalLoggerMock();
71
- logger = new SimpleLogger('info', externalLoggerMock);
17
+ it('should not log below current level', () => {
18
+ const logger = new SimpleLogger(null, { level: 'warn' });
19
+ logger.info('should not log');
20
+ logger.warn('should log');
21
+ expect(consoleSpy).toHaveBeenCalledOnce();
22
+ expect(consoleSpy.mock.calls[0][0]).toMatch(/should log/);
23
+ });
24
+ it('should respect msgPrefix', () => {
25
+ const logger = new SimpleLogger(null, { msgPrefix: '[PREFIX]' });
26
+ logger.info('message');
27
+ expect(consoleSpy.mock.calls[0][0]).toMatch(/\[PREFIX\]/);
72
28
  });
73
- it('should use console as default external logger', () => {
74
- const defaultLogger = new SimpleLogger();
75
- assert.ok(defaultLogger);
29
+ it('should use external logger methods if provided', () => {
30
+ const external = {
31
+ info: vi.fn(),
32
+ level: 'info',
33
+ };
34
+ const logger = new SimpleLogger(external);
35
+ logger.info('external log');
36
+ expect(external.info).toHaveBeenCalledOnce();
37
+ expect(external.info).toHaveBeenCalledWith('external log');
76
38
  });
77
- it('should set the correct log level', () => {
78
- logger.setLevel('DEBUG');
79
- assert.notStrictEqual(logger.trace, () => { });
80
- assert.strictEqual(typeof logger.debug, 'function');
81
- assert.strictEqual(typeof logger.info, 'function');
39
+ it('should fallback to console for invalid external logger', () => {
40
+ const logger = new SimpleLogger({});
41
+ logger.info('fallback');
42
+ expect(consoleSpy).toHaveBeenCalled();
82
43
  });
83
- it('should call external logger methods appropriately', () => {
84
- logger.trace('trace message');
85
- logger.debug('debug message');
86
- logger.info('info message');
87
- logger.warn('warn message');
88
- logger.error('error message');
89
- logger.fatal('fatal message');
90
- assert.strictEqual(externalLoggerMock.trace.mock.calls.length, 0); // because default level is INFO
91
- assert.strictEqual(externalLoggerMock.debug.mock.calls.length, 0); // because default level is INFO
92
- assert.strictEqual(externalLoggerMock.info.mock.calls.length, 1);
93
- assert.strictEqual(externalLoggerMock.info.mock.calls[0][0], 'info message');
94
- assert.strictEqual(externalLoggerMock.warn.mock.calls.length, 1);
95
- assert.strictEqual(externalLoggerMock.warn.mock.calls[0][0], 'warn message');
96
- assert.strictEqual(externalLoggerMock.error.mock.calls.length, 1);
97
- assert.strictEqual(externalLoggerMock.error.mock.calls[0][0], 'error message');
98
- assert.strictEqual(externalLoggerMock.fatal.mock.calls.length, 1);
99
- assert.strictEqual(externalLoggerMock.fatal.mock.calls[0][0], 'fatal message');
44
+ it('should create child logger with merged bindings', () => {
45
+ const logger = new SimpleLogger(null, { bindings: { user: 'A' } });
46
+ const child = logger.child({ request: '123' });
47
+ child.info('child message');
48
+ expect(consoleSpy.mock.calls.length).toBe(1);
49
+ const output = consoleSpy.mock.calls[0][0];
50
+ expect(output).toMatch(/user=A/);
51
+ expect(output).toMatch(/request=123/);
52
+ expect(output).toMatch(/child message/);
100
53
  });
101
- it('should log function start and end', () => {
102
- logger.setLevel('TRACE');
103
- function testFunction() {
104
- logger.logFunctionStart();
105
- logger.logFunctionEnd();
106
- }
107
- testFunction();
108
- assert.strictEqual(externalLoggerMock.trace.mock.calls.length, 2);
109
- assert.strictEqual(externalLoggerMock.trace.mock.calls[0][0], 'Function start: testFunction');
110
- assert.strictEqual(externalLoggerMock.trace.mock.calls[1][0], 'Function end: testFunction');
54
+ it('should call .child if external logger supports it', () => {
55
+ const childFn = vi.fn(() => ({
56
+ info: vi.fn(),
57
+ level: 'info',
58
+ }));
59
+ const external = { level: 'info', child: childFn, info: vi.fn() };
60
+ const logger = new SimpleLogger(external);
61
+ const child = logger.child({ traceId: 'xyz' });
62
+ child.info('from child');
63
+ expect(childFn).toHaveBeenCalledWith({ traceId: 'xyz' });
111
64
  });
112
65
  });
113
66
  //# sourceMappingURL=simple-logger.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"simple-logger.test.js","sourceRoot":"","sources":["../../src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