hermodlog 1.4.1 → 1.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermodlog",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "Simple contextual logger to simplify log display in heavy load context and provide easy parsing",
5
5
  "main": "src/Logger.js",
6
6
  "type": "module",
@@ -18,10 +18,7 @@
18
18
  "url": "https://github.com/Alex-Werner/hermodlog/issues"
19
19
  },
20
20
  "homepage": "https://github.com/Alex-Werner/hermodlog#readme",
21
- "dependencies": {
22
- "chalk": "^5.3.0"
23
- },
24
21
  "devDependencies": {
25
- "vitest": "^0.34.5"
22
+ "vitest": "^3.2.4"
26
23
  }
27
24
  }
package/src/LOG_COLORS.js CHANGED
@@ -1,13 +1,13 @@
1
- import chalk from "chalk";
1
+ import colors from './utils/colors.js';
2
2
 
3
3
  const LOG_COLORS = {
4
4
  // [date color, type color, context color, module color, listener color, method color, object color, string color, function color, number/default color]
5
- debug: [chalk.gray, chalk.blue, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.blue, chalk.blue, chalk.blue, chalk.blue],
6
- error: [chalk.gray, chalk.red, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.red, chalk.red, chalk.red, chalk.red],
7
- fatal: [chalk.gray, chalk.magenta, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.magenta, chalk.magenta, chalk.magenta, chalk.magenta],
8
- info: [chalk.gray, chalk.green, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.green, chalk.green, chalk.green, chalk.green],
9
- trace: [chalk.gray, chalk.gray, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.gray, chalk.gray, chalk.gray, chalk.gray],
10
- warn: [chalk.gray, chalk.yellow, chalk.blueBright, chalk.gray, chalk.cyan, chalk.yellow, chalk.yellow, chalk.yellow, chalk.yellow, chalk.yellow],
5
+ debug: [colors.gray, colors.blue, colors.blueBright, colors.gray, colors.cyan, colors.yellow, colors.blue, colors.blue, colors.blue, colors.blue],
6
+ error: [colors.gray, colors.red, colors.blueBright, colors.gray, colors.cyan, colors.yellow, colors.red, colors.red, colors.red, colors.red],
7
+ fatal: [colors.gray, colors.magenta, colors.blueBright, colors.gray, colors.cyan, colors.yellow, colors.magenta, colors.magenta, colors.magenta, colors.magenta],
8
+ info: [colors.gray, colors.green, colors.blueBright, colors.gray, colors.cyan, colors.yellow, colors.green, colors.green, colors.green, colors.green],
9
+ trace: [colors.gray, colors.gray, colors.blueBright, colors.gray, colors.cyan, colors.yellow, colors.gray, colors.gray, colors.gray, colors.gray],
10
+ warn: [colors.gray, colors.yellow, colors.blueBright, colors.gray, colors.cyan, colors.yellow, colors.yellow, colors.yellow, colors.yellow, colors.yellow],
11
11
  }
12
12
 
13
13
  export default LOG_COLORS;
package/src/Logger.js CHANGED
@@ -2,6 +2,7 @@ import LOG_LEVELS from "./LOG_LEVELS.js";
2
2
 
3
3
  import context from "./methods/context.js";
4
4
  import debug from "./methods/debug.js";
5
+ import dir from "./methods/dir.js";
5
6
  import error from "./methods/error.js";
6
7
  import info from "./methods/info.js";
7
8
  import listener from "./methods/listener.js";
@@ -17,24 +18,60 @@ import LOG_COLORS from "./LOG_COLORS.js";
17
18
  import object from "./methods/object.js";
18
19
  class Logger {
19
20
  constructor(props = {}) {
20
- this.level = props.level ?? 'info';
21
- if (!LOG_LEVELS.hasOwnProperty(this.level)) {
22
- throw new Error(`Unknown log level ${this.level}`)
23
- }
24
-
25
- this.history = props.history ?? [];
26
-
27
- this.contextName = props.contextName ?? null;
28
- this.methodName = props.methodName ?? null;
29
- this.moduleName = props.moduleName ?? null;
30
- this.listenerName = props.listenerName ?? null;
31
- this.objectName = props.objectName ?? null;
21
+ Object.defineProperties(this, {
22
+ LOG_COLORS: {
23
+ value: props.colors ?? LOG_COLORS,
24
+ writable: true,
25
+ enumerable: false
26
+ },
27
+ history: {
28
+ value: props.history ?? [],
29
+ writable: true,
30
+ enumerable: false
31
+ },
32
+ level: {
33
+ value: props.level ?? 'info',
34
+ writable: true,
35
+ enumerable: true
36
+ },
37
+ contextName: {
38
+ value: props.contextName ?? null,
39
+ writable: true,
40
+ enumerable: true
41
+ },
42
+ methodName: {
43
+ value: props.methodName ?? null,
44
+ writable: true,
45
+ enumerable: true
46
+ },
47
+ moduleName: {
48
+ value: props.moduleName ?? null,
49
+ writable: true,
50
+ enumerable: true
51
+ },
52
+ listenerName: {
53
+ value: props.listenerName ?? null,
54
+ writable: true,
55
+ enumerable: true
56
+ },
57
+ objectName: {
58
+ value: props.objectName ?? null,
59
+ writable: true,
60
+ enumerable: true
61
+ }
62
+ });
32
63
 
33
64
  if (props.date) {
34
- this.date = props.date;
65
+ Object.defineProperty(this, 'date', {
66
+ value: props.date,
67
+ writable: true,
68
+ enumerable: false
69
+ });
35
70
  }
36
71
 
37
- this.LOG_COLORS = (props.colors) ?? LOG_COLORS;
72
+ if (!LOG_LEVELS.hasOwnProperty(this.level)) {
73
+ throw new Error(`Unknown log level ${this.level}`)
74
+ }
38
75
  }
39
76
 
40
77
  _log(message) {
@@ -64,11 +101,11 @@ class Logger {
64
101
  objectName: (keepObject) ? this.objectName : opts.objectName ?? null,
65
102
  })
66
103
  }
67
-
68
104
  };
69
105
 
70
106
  Logger.prototype.context = context;
71
107
  Logger.prototype.debug = debug;
108
+ Logger.prototype.dir = dir;
72
109
  Logger.prototype.error = error;
73
110
  Logger.prototype.fatal = fatal;
74
111
  Logger.prototype.info = info;
@@ -10,32 +10,36 @@ describe('Logger', () => {
10
10
  assert.equal(silentLogger.history.length, 0)
11
11
  silentLogger.log('Hello');
12
12
  assert.equal(silentLogger.history.length, 1)
13
- assert.equal(silentLogger.history[0], '[\u001b[90m2023-07-29T01:38:00.482Z\u001b[39m]\u001b[32mHello\u001b[39m')
13
+ const expected = '[\u001b[90m2023-07-29T01:38:00.482Z\u001b[0m] \u001b[32mHello\u001b[0m'
14
+ assert.equal(silentLogger.history[0], expected)
14
15
  })
15
16
  it('should create an logger with module', () => {
16
17
  silentModuleLogger = silentLogger.module('test-module')
17
18
  silentModuleLogger.log('Hello');
18
19
  assert.equal(silentModuleLogger.history.length, 1)
19
- assert.equal(silentModuleLogger.history[0], "[\u001b[90m2023-07-29T01:38:00.482Z\u001b[39m] module:\u001b[90mtest-module\u001b[39m \u001b[32mHello\u001b[39m")
20
+ const expected = '[\u001b[90m2023-07-29T01:38:00.482Z\u001b[0m] module:\u001b[90mtest-module\u001b[0m \u001b[32mHello\u001b[0m'
21
+ assert.equal(silentModuleLogger.history[0], expected)
20
22
  })
21
23
  it('should create an logger with context', () => {
22
24
  const silentContextLogger = silentModuleLogger.context('test-context')
23
25
  silentContextLogger.log('Hello');
24
26
  assert.equal(silentContextLogger.history.length, 1)
25
- assert.equal(silentContextLogger.history[0], "[\u001b[90m2023-07-29T01:38:00.482Z\u001b[39m] context: \u001b[94mtest-context\u001b[39m | module:\u001b[90mtest-module\u001b[39m \u001b[32mHello\u001b[39m")
27
+ const expected = '[\u001b[90m2023-07-29T01:38:00.482Z\u001b[0m] context: \u001b[94mtest-context\u001b[0m | module:\u001b[90mtest-module\u001b[0m \u001b[32mHello\u001b[0m'
28
+ assert.equal(silentContextLogger.history[0], expected)
26
29
  })
27
30
  it('should create an logger with listener', () => {
28
31
  const silentListenerLogger = silentModuleLogger.listener('onTest')
29
32
  silentListenerLogger.log('Hello');
30
33
  assert.equal(silentListenerLogger.history.length, 1)
31
- assert.equal(silentListenerLogger.history[0], "[\u001b[90m2023-07-29T01:38:00.482Z\u001b[39m] module:\u001b[90mtest-module\u001b[39m | listener: \u001b[36monTest\u001b[39m \u001b[32mHello\u001b[39m")
34
+ const expected = '[\u001b[90m2023-07-29T01:38:00.482Z\u001b[0m] module:\u001b[90mtest-module\u001b[0m | listener: \u001b[36monTest\u001b[0m \u001b[32mHello\u001b[0m'
35
+ assert.equal(silentListenerLogger.history[0], expected)
32
36
  })
33
37
  it('should create an logger with method', () => {
34
38
  const silentMethodLogger = silentModuleLogger.method('test-method')
35
39
  silentMethodLogger.log('Hello');
36
40
  assert.equal(silentMethodLogger.history.length, 1)
37
-
38
- assert.equal(silentMethodLogger.history[0], '[\u001b[90m2023-07-29T01:38:00.482Z\u001b[39m] module:\u001b[90mtest-module\u001b[39m | method: \u001b[33mtest-method\u001b[39m \u001b[32mHello\u001b[39m')
41
+ const expected = '[\u001b[90m2023-07-29T01:38:00.482Z\u001b[0m] module:\u001b[90mtest-module\u001b[0m | method: \u001b[33mtest-method\u001b[0m \u001b[32mHello\u001b[0m'
42
+ assert.equal(silentMethodLogger.history[0], expected)
39
43
  })
40
44
  it('should handle level', function () {
41
45
  const levelLogger = new Logger({level: 'error'})
@@ -60,17 +64,7 @@ describe('Logger', () => {
60
64
  }
61
65
  silentModuleLogger.log('Received from ws client', object)
62
66
  assert.equal(silentModuleLogger.history.length, 2)
63
- // If you change the styling of below it will assume spaces are part of the string
64
- assert.equal(silentModuleLogger.history[1], `[\u001b[90m2023-07-29T01:38:00.482Z\u001b[39m] module:\u001b[90mtest-module\u001b[39m \u001b[32mReceived from ws client\u001b[39m \u001b[32mObject(\u001b[39m\u001b[32m{\u001b[39m
65
- \u001b[32m "x": 42,\u001b[39m
66
- \u001b[32m "y": {\u001b[39m
67
- \u001b[32m "b": [\u001b[39m
68
- \u001b[32m 1,\u001b[39m
69
- \u001b[32m 2,\u001b[39m
70
- \u001b[32m 3\u001b[39m
71
- \u001b[32m ]\u001b[39m
72
- \u001b[32m },\u001b[39m
73
- \u001b[32m "req": "getCar"\u001b[39m
74
- \u001b[32m}\u001b[39m \u001b[32m)\u001b[39m`)
67
+ const expected = `[\u001b[90m2023-07-29T01:38:00.482Z\u001b[0m] module:\u001b[90mtest-module\u001b[0m \u001b[32mReceived from ws client\u001b[0m \u001b[32mObject(\u001b[0m\u001b[32m{\n \"x\": 42,\n \"y\": {\n \"b\": [\n 1,\n 2,\n 3\n ]\n },\n \"req\": \"getCar\"\n}\u001b[0m\u001b[32m)\u001b[0m`;
68
+ assert.equal(silentModuleLogger.history[1], expected)
75
69
  });
76
70
  })
@@ -0,0 +1,10 @@
1
+ import LOG_LEVELS from "../LOG_LEVELS.js";
2
+ import log from "../utils/log.js";
3
+
4
+ export default function dir(label, object) {
5
+ if(LOG_LEVELS[this.level] > LOG_LEVELS['info']){
6
+ return;
7
+ }
8
+ log('log', [label], this);
9
+ console.dir(object, { depth: 1, colors: true });
10
+ }
@@ -1,6 +1,7 @@
1
1
  import LOG_LEVELS from "../LOG_LEVELS.js";
2
2
  import _log from "../utils/log.js";
3
3
  export default function log(...args) {
4
+ console.log(`log: ${args}`);
4
5
  if(LOG_LEVELS[this.level] > LOG_LEVELS['info']){
5
6
  return;
6
7
  }
@@ -0,0 +1,17 @@
1
+ const ESC = '\x1b';
2
+
3
+ const createColorFn = (code) => (text) => `${ESC}[${code}m${text}${ESC}[0m`;
4
+
5
+ const colors = {
6
+ gray: createColorFn('90'),
7
+ red: createColorFn('31'),
8
+ green: createColorFn('32'),
9
+ yellow: createColorFn('33'),
10
+ blue: createColorFn('34'),
11
+ magenta: createColorFn('35'),
12
+ cyan: createColorFn('36'),
13
+ // Bright variants
14
+ blueBright: createColorFn('94'),
15
+ };
16
+
17
+ export default colors;
package/src/utils/log.js CHANGED
@@ -4,9 +4,12 @@ function safeStringify(obj, indent = 2, depth = 5, level = 0) {
4
4
  obj,
5
5
  (key, value) => {
6
6
  if (level > depth) return '...';
7
+ if (typeof value === 'bigint') {
8
+ return value.toString();
9
+ }
7
10
  if (typeof value === "object" && value !== null) {
8
- if (cache.includes(value)) return undefined; // Duplicate reference found, discard key
9
- cache.push(value); // Store value in our collection
11
+ if (cache.includes(value)) return undefined;
12
+ cache.push(value);
10
13
  level++;
11
14
  }
12
15
  return value;
@@ -22,73 +25,108 @@ export default function log(level, args, context) {
22
25
  const colors = LOG_COLORS[level] || LOG_COLORS['info'];
23
26
  const date = context.date || new Date();
24
27
  let type = level.toUpperCase()[0];
25
- let message = `[${colors[0](date.toISOString())}][${colors[1](type)}]`;
28
+ let message = `[${colors[0](date.toISOString())}]`;
26
29
 
27
- if(level === 'log'){
28
- message = `[${colors[0](date.toISOString())}]`;
30
+ if (level !== 'log') {
31
+ message += `[${colors[1](type)}]`;
29
32
  }
30
33
 
31
-
32
- // TODO: It would be neat to just have a single parents array that would be used
33
- // to generate the context string.
34
- if(context.contextName){
35
- message += ` context: ${colors[2](context.contextName)} |`;
36
- }
37
- if(context.moduleName){
38
- message += ` module:${colors[3](context.moduleName)} |`;
34
+ if (context.contextName) {
35
+ message += ` context: ${colors[2](context.contextName)}`;
36
+ if (context.moduleName || context.listenerName || context.methodName) {
37
+ message += ' |';
38
+ }
39
39
  }
40
- if(context.listenerName){
41
- message += ` listener: ${colors[4](context.listenerName)} |`;
40
+
41
+ if (context.moduleName) {
42
+ message += ` module:${colors[3](context.moduleName)}`;
43
+ if (context.listenerName || context.methodName) {
44
+ message += ' |';
45
+ }
42
46
  }
43
- if(context.methodName){
44
- message += ` method: ${colors[5](context.methodName)} |`;
47
+
48
+ if (context.listenerName) {
49
+ message += ` listener: ${colors[4](context.listenerName)}`;
50
+ if (context.methodName) {
51
+ message += ' |';
52
+ }
45
53
  }
46
- if(context.objectName){
47
- message += ` Object[${colors[6](context.objectName)}] |`;
54
+
55
+ if (context.methodName) {
56
+ message += ` method: ${colors[5](context.methodName)}`;
48
57
  }
49
58
 
50
- if(message.endsWith(' |')){
51
- message = message.slice(0, -1);
59
+ if (context.objectName) {
60
+ message += ` Object[${colors[6](context.objectName)}]`;
52
61
  }
53
62
 
54
- for(let i = 0; i < args.length; i++){
55
- const typeOfArg = typeof args[i];
63
+ message += ' ';
64
+
65
+ for (let i = 0; i < args.length; i++) {
66
+ const arg = args[i];
67
+ const typeOfArg = typeof arg;
56
68
  let color;
57
- switch (typeOfArg){
69
+
70
+ switch (typeOfArg) {
58
71
  case 'object':
59
- color = colors[6]; // object color
60
- const constructorName = args[i].constructor.name;
61
- message += ` ${color(`${constructorName}(`)}`
62
- try {
63
- if(constructorName === 'Error'){
64
- message += color(safeStringify(args[i].message, 3, 4))
72
+ color = colors[6];
73
+ if (!arg) {
74
+ message += `${color('null')}`;
75
+ break;
76
+ }
77
+ const constructorName = arg?.constructor?.name;
78
+ if (constructorName === 'Object') {
79
+ message += `${color('Object(')}${color(safeStringify(arg, 2))}${color(')')}`;
80
+ } else if (constructorName === 'Error') {
81
+ message += `${color(constructorName)}(${color(arg.message)})\n`;
82
+ if (arg.stack) {
83
+ const stackLines = arg.stack.split('\n');
84
+ // Skip first line as it contains the error message we already logged
85
+ for (let j = 1; j < stackLines.length; j++) {
86
+ message += `${color(stackLines[j].trim())}\n`;
87
+ }
65
88
  }
66
- message += color(safeStringify(args[i], 3, 4))
67
- } catch (err) {
68
- // Probably a circular reference
69
- message += color(args[i].toString())
89
+ } else {
90
+ message += `${color(constructorName)}(${color(safeStringify(arg, 2))})`;
70
91
  }
71
-
72
- message += ` ${color(")")}`
73
92
  break;
74
93
  case 'string':
75
- color = colors[7]; // string color
76
- message += color(args[i])
94
+ color = colors[7];
95
+ // If the string contains [object Object], try to parse it as a potential object reference
96
+ if (arg.includes('[object Object]')) {
97
+ // Extract the object from the current argument if it's a stringified object
98
+ try {
99
+ const potentialObj = JSON.parse(arg);
100
+ if (typeof potentialObj === 'object' && potentialObj !== null) {
101
+ message += `${color('Object(')}${color(safeStringify(potentialObj, 2))}${color(')')}`;
102
+ } else {
103
+ message += color(arg);
104
+ }
105
+ } catch (e) {
106
+ // If it's not a valid JSON, just display as is
107
+ message += color(arg);
108
+ }
109
+ } else {
110
+ message += color(arg);
111
+ }
77
112
  break;
78
113
  case "function":
79
- color = colors[8]; // function color
80
- message += color(args[i].toString())
114
+ color = colors[8];
115
+ message += color(arg.toString());
81
116
  break;
82
- case "number":
83
117
  default:
84
- color = colors[9]; // number/default color
85
- message += color(args[i])
118
+ color = colors[9];
119
+ message += color(String(arg));
86
120
  break;
87
121
  }
122
+
123
+ if (i < args.length - 1) {
124
+ message += ' ';
125
+ }
88
126
  }
89
127
 
90
128
  context.history.push(message);
91
- if(context.history.length > 100){
129
+ if (context.history.length > 100) {
92
130
  context.history.shift();
93
131
  }
94
132
 
@@ -0,0 +1,68 @@
1
+ import Logger from './src/Logger.js';
2
+
3
+ const logger = new Logger({
4
+ level: 'trace',
5
+ });
6
+
7
+
8
+ logger.context('APIContext').module('Websocket Server').listener('onMessage').method('processIncomingMessage').log('Hello World');
9
+
10
+ const contextLogger = logger.context('APIContext')
11
+ contextLogger.log('Started API');
12
+ const moduleLogger = contextLogger.module('Websocket Server')
13
+ moduleLogger.log('Started WSS');
14
+ const listenerLogger = moduleLogger.listener('onConnection')
15
+ listenerLogger.log('New connection');
16
+ const object = {
17
+ x:42,
18
+ y: {
19
+ b:[1,2,3]
20
+ },
21
+ req:'getCar'
22
+ }
23
+ listenerLogger.method('processIncomingMessage').log('Received from ws client',object)
24
+
25
+ listenerLogger.log(()=>'This is a function that returns a string')
26
+ listenerLogger.log(1,2,3,4,5,6,7,8,9,10)
27
+
28
+ class Car {
29
+ constructor(props) {
30
+ this.name = props.name;
31
+ }
32
+ };
33
+
34
+ const car = new Car({name: 'RSQ'});
35
+
36
+ listenerLogger.method('processIncomingMessage').log('Responding to client object:',car)
37
+ listenerLogger.error('Something happened while sending:',car)
38
+
39
+ listenerLogger.trace('Display me');
40
+ listenerLogger.level = 'error'
41
+ listenerLogger.trace('Do not display me trace on error');
42
+ listenerLogger.log('Do not display me log on error')
43
+ listenerLogger.error('Do display me')
44
+ listenerLogger.level = 'trace'
45
+ listenerLogger.error('Error',object)
46
+ listenerLogger.warn('Warn',object)
47
+ listenerLogger.info('Info',object)
48
+ listenerLogger.fatal('Fatal',object)
49
+ listenerLogger.debug('debug',object)
50
+ listenerLogger.trace('trace',object)
51
+
52
+ const error = new Error('Something happened');
53
+ listenerLogger.error('Error',error)
54
+ listenerLogger.warn('Warn',error)
55
+ listenerLogger.info('Info',error)
56
+ listenerLogger.fatal('Fatal',error)
57
+ listenerLogger.debug('debug',error)
58
+ listenerLogger.trace('trace',error)
59
+
60
+
61
+ const errorWithStack = new Error('Something happened with stack');
62
+ errorWithStack.stack = '\nThis is a stack trace with a new line \n and a tab \t';
63
+ listenerLogger.error('Error',errorWithStack)
64
+
65
+ console.dir(listenerLogger, { depth: null });
66
+
67
+ listenerLogger.log(object);
68
+ listenerLogger.log(`This is a log message with an ${object}`);
package/usage.example.js CHANGED
@@ -5,14 +5,8 @@ const logger = new Logger({
5
5
  });
6
6
 
7
7
 
8
- logger.context('APIContext').module('Websocket Server').listener('onMessage').method('processIncomingMessage').log('Hello World');
9
8
 
10
- const contextLogger = logger.context('APIContext')
11
- contextLogger.log('Started API');
12
- const moduleLogger = contextLogger.module('Websocket Server')
13
- moduleLogger.log('Started WSS');
14
- const listenerLogger = moduleLogger.listener('onConnection')
15
- listenerLogger.log('New connection');
9
+ const listenerLogger = logger.listener('onConnection')
16
10
  const object = {
17
11
  x:42,
18
12
  y: {
@@ -20,40 +14,8 @@ const object = {
20
14
  },
21
15
  req:'getCar'
22
16
  }
23
- listenerLogger.method('processIncomingMessage').log('Received from ws client',object)
24
17
 
25
- listenerLogger.log(()=>'This is a function that returns a string')
26
- listenerLogger.log(1,2,3,4,5,6,7,8,9,10)
18
+ listenerLogger.log(`${object}`);
27
19
 
28
- class Car {
29
- constructor(props) {
30
- this.name = props.name;
31
- }
32
- };
33
-
34
- const car = new Car({name: 'RSQ'});
35
-
36
- listenerLogger.method('processIncomingMessage').log('Responding to client object:',car)
37
- listenerLogger.error('Something happened while sending:',car)
38
-
39
- listenerLogger.trace('Display me');
40
- listenerLogger.level = 'error'
41
- listenerLogger.trace('Do not display me trace on error');
42
- listenerLogger.log('Do not display me log on error')
43
- listenerLogger.error('Do display me')
44
- listenerLogger.level = 'trace'
45
- listenerLogger.error('Error',object)
46
- listenerLogger.warn('Warn',object)
47
- listenerLogger.info('Info',object)
48
- listenerLogger.fatal('Fatal',object)
49
- listenerLogger.debug('debug',object)
50
- listenerLogger.trace('trace',object)
51
-
52
- const error = new Error('Something happened');
53
- listenerLogger.error('Error',error)
54
- listenerLogger.warn('Warn',error)
55
- listenerLogger.info('Info',error)
56
- listenerLogger.fatal('Fatal',error)
57
- listenerLogger.debug('debug',error)
58
- listenerLogger.trace('trace',error)
59
20
 
21
+ console.log({logger});