@darksheep/logger 1.0.7 → 1.0.8

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 (40) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/package.json +4 -6
  3. package/src/create-logger.js +1 -1
  4. package/src/formatters/formatter-console.js +22 -22
  5. package/src/formatters/formatter-json.js +1 -1
  6. package/src/logger.js +70 -66
  7. package/src/replacer.js +9 -8
  8. package/src/replacers/buffers.js +1 -1
  9. package/src/replacers/error.js +4 -8
  10. package/src/stdout-write.js +1 -1
  11. package/src/utilities/colour.js +20 -20
  12. package/src/utilities/environment.js +1 -1
  13. package/src/utilities/json-path.js +4 -4
  14. package/src/utilities/last-callsite.js +1 -1
  15. package/src/utilities/log-filters.js +4 -4
  16. package/src/utilities/log-types.js +14 -14
  17. package/src/utilities/parse-filters.js +15 -10
  18. package/src/utilities/parse-log-level.js +13 -13
  19. package/src/utilities/stacktrace.js +8 -8
  20. package/types/assert.zod.d.ts +4 -4
  21. package/types/create-logger.d.ts +1 -1
  22. package/types/formatters/formatter-console.d.ts +1 -1
  23. package/types/formatters/formatter-json.d.ts +1 -1
  24. package/types/logger.d.ts +62 -61
  25. package/types/replacer.d.ts +11 -11
  26. package/types/replacers/error.d.ts +6 -6
  27. package/types/stdout-write.d.ts +1 -1
  28. package/types/utilities/colour.d.ts +16 -16
  29. package/types/utilities/json-path.d.ts +1 -1
  30. package/types/utilities/last-callsite.d.ts +1 -1
  31. package/types/utilities/log-filters.d.ts +4 -4
  32. package/types/utilities/log-types.d.ts +28 -28
  33. package/types/utilities/parse-filters.d.ts +2 -2
  34. package/types/utilities/parse-log-level.d.ts +3 -3
  35. package/types/utilities/stacktrace.d.ts +16 -16
  36. package/types/logger.test.d.ts +0 -1
  37. package/types/replacer.test.d.ts +0 -1
  38. package/types/replacers/buffers.test.d.ts +0 -1
  39. package/types/replacers/error.test.d.ts +0 -1
  40. package/types/replacers/http-client-request.test.d.ts +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @param {string[]} nodes The nodes to the element
2
+ * @param {string[]} nodes - The nodes to the element.
3
3
  * @returns {string}
4
4
  */
5
5
  export function nodesToPath(nodes: string[]): string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Get the callsite that we think is outside the package
2
+ * Get the callsite that we think is outside the package.
3
3
  * @returns {{ file: string, line: number, column: number } | void}
4
4
  */
5
5
  export function getLastCallsite(): {
@@ -1,12 +1,12 @@
1
1
  /**
2
- * Check to see if {loggerLevel} should get logged
3
- * @param {import('./log-types.js').LogLevel} level The log level to check
2
+ * Check to see if {loggerLevel} should get logged.
3
+ * @param {import('./log-types.js').LogLevel} level - The log level to check.
4
4
  * @returns {boolean}
5
5
  */
6
6
  export function checkLogLevel(level: import("./log-types.js").LogLevel): boolean;
7
7
  /**
8
- * Check to see if a message with {channel} should get logged
9
- * @param {string} [channel] The channel to check
8
+ * Check to see if a message with {channel} should get logged.
9
+ * @param {string} [channel] - The channel to check.
10
10
  * @returns {boolean}
11
11
  */
12
12
  export function checkLogFilters(channel?: string | undefined): boolean;
@@ -1,42 +1,42 @@
1
1
  export type LogLevels = {
2
2
  /**
3
- * A crucial part of the application is not working
3
+ * - A crucial part of the application is not working.
4
4
  */
5
5
  critical: 0;
6
6
  /**
7
- * A non critical operation fails
7
+ * - A non critical operation fails.
8
8
  */
9
9
  error: 1;
10
10
  /**
11
- * An operation might fail in the future
11
+ * - An operation might fail in the future.
12
12
  */
13
13
  warning: 2;
14
14
  /**
15
- * Information about events that may be unusual
15
+ * - Information about events that may be unusual.
16
16
  */
17
17
  notice: 3;
18
18
  /**
19
- * Information about successful operations
19
+ * - Information about successful operations.
20
20
  */
21
21
  info: 4;
22
22
  /**
23
- * Information that is unlikely to help in production
23
+ * - Information that is unlikely to help in production.
24
24
  */
25
25
  debug: 5;
26
26
  /**
27
- * Information to help resolve complex logic issues
27
+ * - Information to help resolve complex logic issues.
28
28
  */
29
29
  silly: 6;
30
30
  };
31
31
  /**
32
32
  * @typedef {Object} LogLevels
33
- * @property {0} critical A crucial part of the application is not working
34
- * @property {1} error A non critical operation fails
35
- * @property {2} warning An operation might fail in the future
36
- * @property {3} notice Information about events that may be unusual
37
- * @property {4} info Information about successful operations
38
- * @property {5} debug Information that is unlikely to help in production
39
- * @property {6} silly Information to help resolve complex logic issues
33
+ * @property {0} critical - A crucial part of the application is not working.
34
+ * @property {1} error - A non critical operation fails.
35
+ * @property {2} warning - An operation might fail in the future.
36
+ * @property {3} notice - Information about events that may be unusual.
37
+ * @property {4} info - Information about successful operations.
38
+ * @property {5} debug - Information that is unlikely to help in production.
39
+ * @property {6} silly - Information to help resolve complex logic issues.
40
40
  */
41
41
  /** @type {LogLevels} */
42
42
  export const LogLevels: LogLevels;
@@ -49,33 +49,33 @@ export type Callsite = import("./stacktrace.js").Callsite;
49
49
  export type NormalisedError = import("../replacers/error.js").NormalisedError;
50
50
  export type LogInternal = {
51
51
  /**
52
- * A timestamp for the log message
52
+ * - A timestamp for the log message.
53
53
  */
54
- timestamp?: Date | undefined;
54
+ timestamp?: Date;
55
55
  /**
56
- * A channel to bind to the log
56
+ * - A channel to bind to the log.
57
57
  */
58
- channel?: string | undefined;
58
+ channel?: string;
59
59
  /**
60
- * The log level
60
+ * - The log level.
61
61
  */
62
- level?: LogLevel | undefined;
62
+ level?: LogLevel;
63
63
  /**
64
- * A message to use
64
+ * - A message to use.
65
65
  */
66
- message?: string | undefined;
66
+ message?: string;
67
67
  /**
68
- * The stack trace bound to the log
68
+ * - The stack trace bound to the log.
69
69
  */
70
- stack?: string | import("./stacktrace.js").Callsite[] | undefined;
70
+ stack?: string | Callsite[];
71
71
  /**
72
- * A child error for the core error
72
+ * - A child error for the core error.
73
73
  */
74
- cause?: Error | import("../replacers/error.js").NormalisedError | undefined;
74
+ cause?: NormalisedError | Error;
75
75
  /**
76
- * The trail id bound to the callsite
76
+ * - The trail id bound to the callsite.
77
77
  */
78
- trail?: string | undefined;
78
+ trail?: string;
79
79
  };
80
80
  export type LogContext = LogInternal & Record<string, unknown>;
81
81
  export type LogEntry = {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @param {string} [filter] The filter string
3
- * @param {RegExp[]} [fallback] Fallback to the following allowed regexp
2
+ * @param {string} [filter] - The filter string.
3
+ * @param {RegExp[]} [fallback] - Fallback to the following allowed regexp.
4
4
  * @returns {{ allowed: RegExp[], blocked: RegExp[] }}
5
5
  */
6
6
  export function parseFilters(filter?: string | undefined, fallback?: RegExp[] | undefined): {
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Convert a given string to a LogLevel
3
- * @param {string} [input] The string to convert
4
- * @param {string} [node] The current NODE_ENV
2
+ * Convert a given string to a LogLevel.
3
+ * @param {string} [input] - The string to convert.
4
+ * @param {string} [node] - The current NODE_ENV.
5
5
  * @returns {import('./log-types.js').LogLevel}
6
6
  */
7
7
  export function parseLogLevel(input?: string | undefined, node?: string | undefined): import("./log-types.js").LogLevel;
@@ -1,41 +1,41 @@
1
1
  /**
2
2
  * @typedef {Object} Callsite
3
- * @property {string} file The file name for the callsite
4
- * @property {string} [relativePath] The relative path for the callsite.file
5
- * @property {string} [absolutePath] The absolute path for the callsite.file
6
- * @property {string} methodName The methodName from the callsite
7
- * @property {number} line The line number in the file
8
- * @property {number} column The column number in the file
3
+ * @property {string} file - The file name for the callsite.
4
+ * @property {string} [relativePath] - The relative path for the callsite.file.
5
+ * @property {string} [absolutePath] - The absolute path for the callsite.file.
6
+ * @property {string} methodName - The methodName from the callsite.
7
+ * @property {number} line - The line number in the file.
8
+ * @property {number} column - The column number in the file.
9
9
  */
10
10
  /**
11
- * Get the callsite that we think is outside the package
12
- * @param {string} [stack] The stacktrace to parse
11
+ * Get the callsite that we think is outside the package.
12
+ * @param {string} [stack] - The stacktrace to parse.
13
13
  * @returns {Callsite[]}
14
14
  */
15
15
  export function parseStack(stack?: string | undefined): Callsite[];
16
16
  export type Callsite = {
17
17
  /**
18
- * The file name for the callsite
18
+ * - The file name for the callsite.
19
19
  */
20
20
  file: string;
21
21
  /**
22
- * The relative path for the callsite.file
22
+ * - The relative path for the callsite.file.
23
23
  */
24
- relativePath?: string | undefined;
24
+ relativePath?: string;
25
25
  /**
26
- * The absolute path for the callsite.file
26
+ * - The absolute path for the callsite.file.
27
27
  */
28
- absolutePath?: string | undefined;
28
+ absolutePath?: string;
29
29
  /**
30
- * The methodName from the callsite
30
+ * - The methodName from the callsite.
31
31
  */
32
32
  methodName: string;
33
33
  /**
34
- * The line number in the file
34
+ * - The line number in the file.
35
35
  */
36
36
  line: number;
37
37
  /**
38
- * The column number in the file
38
+ * - The column number in the file.
39
39
  */
40
40
  column: number;
41
41
  };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};