jet-logger 2.2.1 → 2.2.2

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.
@@ -44,9 +44,7 @@ const Errors = {
44
44
  export const JetLogger = {
45
45
  Modes: LOGGER_MODES,
46
46
  Formats: FORMATS,
47
- instanceOf,
48
47
  };
49
- const kJetLogger = Symbol('k-jet-logger');
50
48
  export function jetLogger(options) {
51
49
  let mode = DEFAULTS.mode, filePath = DEFAULTS.filePath, timestamp = DEFAULTS.timestamp, format = DEFAULTS.format, customLogFn = DEFAULTS.customLogFn;
52
50
  if (options?.mode !== undefined) {
@@ -61,7 +59,6 @@ export function jetLogger(options) {
61
59
  imp: (_, __) => ({}),
62
60
  warn: (_, __) => ({}),
63
61
  err: (_, __) => ({}),
64
- [kJetLogger]: true,
65
62
  };
66
63
  }
67
64
  if (mode === LOGGER_MODES.Custom) {
@@ -76,7 +73,6 @@ export function jetLogger(options) {
76
73
  imp: setupPrintWithCustomLogger(LEVELS.Important, customLogFn),
77
74
  warn: setupPrintWithCustomLogger(LEVELS.Warning, customLogFn),
78
75
  err: setupPrintWithCustomLogger(LEVELS.Error, customLogFn),
79
- [kJetLogger]: true,
80
76
  };
81
77
  }
82
78
  if (options?.filepath !== undefined) {
@@ -122,7 +118,6 @@ export function jetLogger(options) {
122
118
  imp: setupPrintToFile(LEVELS.Important, formatter, filePath),
123
119
  warn: setupPrintToFile(LEVELS.Warning, formatter, filePath),
124
120
  err: setupPrintToFile(LEVELS.Error, formatter, filePath),
125
- [kJetLogger]: true,
126
121
  };
127
122
  }
128
123
  return {
@@ -130,7 +125,6 @@ export function jetLogger(options) {
130
125
  imp: setupPrintToConsole(LEVELS.Important, formatter),
131
126
  warn: setupPrintToConsole(LEVELS.Warning, formatter),
132
127
  err: setupPrintToConsole(LEVELS.Error, formatter),
133
- [kJetLogger]: true,
134
128
  };
135
129
  }
136
130
  function setupPrintWithCustomLogger(level, customLogFn) {
@@ -222,8 +216,4 @@ function addDatetimeToFileName(filePath) {
222
216
  filePathArr[lastIdx] = fileNameNew;
223
217
  return filePathArr.join('/');
224
218
  }
225
- function instanceOf(arg) {
226
- return (typeof arg === 'object' &&
227
- arg[kJetLogger] === true);
228
- }
229
219
  export default jetLogger();
@@ -44,9 +44,7 @@ const Errors = {
44
44
  export const JetLogger = {
45
45
  Modes: LOGGER_MODES,
46
46
  Formats: FORMATS,
47
- instanceOf,
48
47
  };
49
- const kJetLogger = Symbol('k-jet-logger');
50
48
  export function jetLogger(options) {
51
49
  let mode = DEFAULTS.mode, filePath = DEFAULTS.filePath, timestamp = DEFAULTS.timestamp, format = DEFAULTS.format, customLogFn = DEFAULTS.customLogFn;
52
50
  if (options?.mode !== undefined) {
@@ -61,7 +59,6 @@ export function jetLogger(options) {
61
59
  imp: (_, __) => ({}),
62
60
  warn: (_, __) => ({}),
63
61
  err: (_, __) => ({}),
64
- [kJetLogger]: true,
65
62
  };
66
63
  }
67
64
  if (mode === LOGGER_MODES.Custom) {
@@ -76,7 +73,6 @@ export function jetLogger(options) {
76
73
  imp: setupPrintWithCustomLogger(LEVELS.Important, customLogFn),
77
74
  warn: setupPrintWithCustomLogger(LEVELS.Warning, customLogFn),
78
75
  err: setupPrintWithCustomLogger(LEVELS.Error, customLogFn),
79
- [kJetLogger]: true,
80
76
  };
81
77
  }
82
78
  if (options?.filepath !== undefined) {
@@ -122,7 +118,6 @@ export function jetLogger(options) {
122
118
  imp: setupPrintToFile(LEVELS.Important, formatter, filePath),
123
119
  warn: setupPrintToFile(LEVELS.Warning, formatter, filePath),
124
120
  err: setupPrintToFile(LEVELS.Error, formatter, filePath),
125
- [kJetLogger]: true,
126
121
  };
127
122
  }
128
123
  return {
@@ -130,7 +125,6 @@ export function jetLogger(options) {
130
125
  imp: setupPrintToConsole(LEVELS.Important, formatter),
131
126
  warn: setupPrintToConsole(LEVELS.Warning, formatter),
132
127
  err: setupPrintToConsole(LEVELS.Error, formatter),
133
- [kJetLogger]: true,
134
128
  };
135
129
  }
136
130
  function setupPrintWithCustomLogger(level, customLogFn) {
@@ -222,8 +216,4 @@ function addDatetimeToFileName(filePath) {
222
216
  filePathArr[lastIdx] = fileNameNew;
223
217
  return filePathArr.join('/');
224
218
  }
225
- function instanceOf(arg) {
226
- return (typeof arg === 'object' &&
227
- arg[kJetLogger] === true);
228
- }
229
219
  export default jetLogger();
@@ -22,9 +22,7 @@ export declare const JetLogger: {
22
22
  readonly Line: "LINE";
23
23
  readonly Json: "JSON";
24
24
  };
25
- readonly instanceOf: typeof instanceOf;
26
25
  };
27
- declare const kJetLogger: unique symbol;
28
26
  /******************************************************************************
29
27
  Types
30
28
  ******************************************************************************/
@@ -40,12 +38,6 @@ interface Options {
40
38
  format?: Formats;
41
39
  customLogger?: CustomLogger;
42
40
  }
43
- interface JetLogger {
44
- info: (content: unknown, print?: boolean) => void;
45
- imp: (content: unknown, print?: boolean) => void;
46
- warn: (content: unknown, print?: boolean) => void;
47
- err: (content: unknown, print?: boolean) => void;
48
- }
49
41
  /******************************************************************************
50
42
  Functions
51
43
  ******************************************************************************/
@@ -57,12 +49,7 @@ export declare function jetLogger(options?: Options): {
57
49
  readonly imp: LogFunction;
58
50
  readonly warn: LogFunction;
59
51
  readonly err: LogFunction;
60
- readonly [kJetLogger]: true;
61
52
  };
62
- /**
63
- * Check if an object is an instance of jetLogger
64
- */
65
- declare function instanceOf(arg: unknown): arg is JetLogger;
66
53
  /******************************************************************************
67
54
  Export
68
55
  ******************************************************************************/
@@ -71,6 +58,5 @@ declare const _default: {
71
58
  readonly imp: LogFunction;
72
59
  readonly warn: LogFunction;
73
60
  readonly err: LogFunction;
74
- readonly [kJetLogger]: true;
75
61
  };
76
62
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jet-logger",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "description": "A super quick, easy to setup logging tool for NodeJS/TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",