namirasoft-log 1.4.6 → 1.4.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 (71) hide show
  1. package/.ns-sdkg-file-keep +11 -11
  2. package/dist/NamirasoftLogServer.d.ts +1 -1
  3. package/dist/NamirasoftLogServer.js +1 -1
  4. package/dist/NamirasoftLogServer.js.map +1 -1
  5. package/dist/NamirasoftLogServerBase.d.ts +2 -2
  6. package/dist/NamirasoftLogServerBase.js +2 -2
  7. package/dist/NamirasoftLogServerBase.js.map +1 -1
  8. package/dist/NamirasoftLogServerLog.d.ts +1 -1
  9. package/dist/NamirasoftLogServerLog.js +8 -8
  10. package/dist/NamirasoftLogServerLog.js.map +1 -1
  11. package/dist/StreamFile.js +17 -7
  12. package/dist/StreamFile.js.map +1 -1
  13. package/dist/command/LogCommand.js +1 -1
  14. package/dist/command/LogCommand.js.map +1 -1
  15. package/dist/command/cli.js +1 -1
  16. package/dist/command/cli.js.map +1 -1
  17. package/dist/meta/LogGroupCategoryMetaTable.d.ts +4 -3
  18. package/dist/meta/LogGroupCategoryMetaTable.js +10 -9
  19. package/dist/meta/LogGroupCategoryMetaTable.js.map +1 -1
  20. package/dist/meta/LogGroupFieldMetaTable.d.ts +4 -3
  21. package/dist/meta/LogGroupFieldMetaTable.js +12 -11
  22. package/dist/meta/LogGroupFieldMetaTable.js.map +1 -1
  23. package/dist/meta/LogGroupMetaTable.d.ts +4 -3
  24. package/dist/meta/LogGroupMetaTable.js +12 -11
  25. package/dist/meta/LogGroupMetaTable.js.map +1 -1
  26. package/dist/meta/LogGroupTagMetaTable.d.ts +4 -3
  27. package/dist/meta/LogGroupTagMetaTable.js +12 -11
  28. package/dist/meta/LogGroupTagMetaTable.js.map +1 -1
  29. package/dist/meta/LogMetaTable.d.ts +4 -3
  30. package/dist/meta/LogMetaTable.js +12 -11
  31. package/dist/meta/LogMetaTable.js.map +1 -1
  32. package/dist/meta/MetaDatabase.d.ts +2 -1
  33. package/dist/meta/MetaDatabase.js +8 -6
  34. package/dist/meta/MetaDatabase.js.map +1 -1
  35. package/package.json +27 -27
  36. package/src/BaseFormatter.ts +36 -36
  37. package/src/FormatterFull.ts +19 -19
  38. package/src/FormatterShort.ts +12 -12
  39. package/src/IFormatter.ts +5 -5
  40. package/src/ILogger.ts +17 -17
  41. package/src/IStream.ts +4 -4
  42. package/src/Log.ts +13 -13
  43. package/src/LogLevel.ts +11 -11
  44. package/src/Logger.ts +126 -126
  45. package/src/NamirasoftLogServer.ts +50 -50
  46. package/src/NamirasoftLogServerBase.ts +29 -29
  47. package/src/NamirasoftLogServerLog.ts +56 -56
  48. package/src/NamirasoftLogServerLogGroup.ts +69 -69
  49. package/src/NamirasoftLogServerLogGroupCategory.ts +62 -62
  50. package/src/NamirasoftLogServerLogGroupField.ts +69 -69
  51. package/src/NamirasoftLogServerLogGroupTag.ts +69 -69
  52. package/src/StreamConsole.ts +37 -37
  53. package/src/StreamFile.ts +47 -47
  54. package/src/StreamNamirasoftLog.ts +30 -30
  55. package/src/command/LogCommand.ts +35 -35
  56. package/src/command/LogGroupCategoryListCommand.ts +44 -44
  57. package/src/command/LogGroupFieldListCommand.ts +44 -44
  58. package/src/command/LogGroupListCommand.ts +44 -44
  59. package/src/command/LogGroupTagListCommand.ts +44 -44
  60. package/src/command/LogListCommand.ts +44 -44
  61. package/src/command/cli.ts +44 -44
  62. package/src/meta/LogGroupCategoryMetaTable.ts +45 -44
  63. package/src/meta/LogGroupFieldMetaTable.ts +49 -48
  64. package/src/meta/LogGroupMetaTable.ts +49 -48
  65. package/src/meta/LogGroupTagMetaTable.ts +49 -48
  66. package/src/meta/LogMetaTable.ts +14 -13
  67. package/src/meta/MetaDatabase.ts +8 -6
  68. package/src/row/LogGroupCategoryRow.ts +28 -28
  69. package/src/row/LogGroupFieldRow.ts +30 -30
  70. package/src/row/LogGroupRow.ts +32 -32
  71. package/src/row/LogGroupTagRow.ts +30 -30
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "namirasoft-log",
3
- "title": "Namirasoft Log NPM Package",
4
- "description": "Namira Software Corporation Log NPM Package",
5
- "icon": "logo.png",
6
- "logo": "https://static.namirasoft.com/image/namirasoft/log/logo/base.png",
7
- "language": "ts",
8
- "framework": "npm",
9
- "application": "package",
10
- "private": false,
11
- "version": "1.4.6",
12
- "author": "Amir Abolhasani",
13
- "license": "MIT",
14
- "main": "./dist/index.js",
15
- "types": "./dist/index.d.ts",
16
- "scripts": {
17
- "build": ""
18
- },
19
- "dependencies": {
20
- "namirasoft-core": "^1.4.13",
21
- "namirasoft-site": "^1.4.0",
22
- "namirasoft-node-cli": "^1.4.4",
23
- "namirasoft-account": "^1.4.23"
24
- },
25
- "bin": {
26
- "ns-log": "./dist/command/cli.js"
27
- }
1
+ {
2
+ "name": "namirasoft-log",
3
+ "title": "Namirasoft Log NPM Package",
4
+ "description": "Namira Software Corporation Log NPM Package",
5
+ "icon": "logo.png",
6
+ "logo": "https://static.namirasoft.com/image/namirasoft/log/logo/base.png",
7
+ "language": "ts",
8
+ "framework": "npm",
9
+ "application": "package",
10
+ "private": false,
11
+ "version": "1.4.8",
12
+ "author": "Amir Abolhasani",
13
+ "license": "MIT",
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "scripts": {
17
+ "build": ""
18
+ },
19
+ "dependencies": {
20
+ "namirasoft-core": "^1.4.21",
21
+ "namirasoft-site": "^1.4.4",
22
+ "namirasoft-node-cli": "^1.4.4",
23
+ "namirasoft-account": "^1.4.25"
24
+ },
25
+ "bin": {
26
+ "ns-log": "./dist/command/cli.js"
27
+ }
28
28
  }
@@ -1,37 +1,37 @@
1
- export abstract class BaseFormatter
2
- {
3
- protected formatDateTime(date: Date)
4
- {
5
- return this.formatDate(date) + " " + this.formatTime(date);
6
- }
7
- protected formatDate(date: Date)
8
- {
9
- const year = date.getFullYear();
10
- const month = (date.getMonth() + 1).toString().padStart(2, '0');
11
- const day = String(date.getDate()).toString().padStart(2, '0');
12
- return `${year}-${month}-${day}`;
13
- }
14
- protected formatTime(date: Date)
15
- {
16
- const hours = String(date.getHours()).padStart(2, '0');
17
- const minutes = String(date.getMinutes()).padStart(2, '0');
18
- const seconds = String(date.getSeconds()).padStart(2, '0');
19
- return `${hours}:${minutes}:${seconds}`;
20
- }
21
- protected qoute(text: string, size: number, filler: string)
22
- {
23
- let count = (size - text.length) / 2;
24
- text = text.padStart(text.length + count, filler);
25
- text = text.padEnd(size, filler);
26
- return text;
27
- }
28
- protected getMesssages(messages: any[]): string[]
29
- {
30
- return messages.map(x =>
31
- {
32
- if (typeof (x) == "object")
33
- return JSON.stringify(x, undefined, 4);
34
- return x + "";
35
- });
36
- }
1
+ export abstract class BaseFormatter
2
+ {
3
+ protected formatDateTime(date: Date)
4
+ {
5
+ return this.formatDate(date) + " " + this.formatTime(date);
6
+ }
7
+ protected formatDate(date: Date)
8
+ {
9
+ const year = date.getFullYear();
10
+ const month = (date.getMonth() + 1).toString().padStart(2, '0');
11
+ const day = String(date.getDate()).toString().padStart(2, '0');
12
+ return `${year}-${month}-${day}`;
13
+ }
14
+ protected formatTime(date: Date)
15
+ {
16
+ const hours = String(date.getHours()).padStart(2, '0');
17
+ const minutes = String(date.getMinutes()).padStart(2, '0');
18
+ const seconds = String(date.getSeconds()).padStart(2, '0');
19
+ return `${hours}:${minutes}:${seconds}`;
20
+ }
21
+ protected qoute(text: string, size: number, filler: string)
22
+ {
23
+ let count = (size - text.length) / 2;
24
+ text = text.padStart(text.length + count, filler);
25
+ text = text.padEnd(size, filler);
26
+ return text;
27
+ }
28
+ protected getMesssages(messages: any[]): string[]
29
+ {
30
+ return messages.map(x =>
31
+ {
32
+ if (typeof (x) == "object")
33
+ return JSON.stringify(x, undefined, 4);
34
+ return x + "";
35
+ });
36
+ }
37
37
  }
@@ -1,20 +1,20 @@
1
- import { BaseFormatter } from "./BaseFormatter";
2
- import { IFormatter } from "./IFormatter";
3
- import { Log } from "./Log";
4
- import { LogLevel } from "./LogLevel";
5
-
6
- export class FormatterFull extends BaseFormatter implements IFormatter
7
- {
8
- format(log: Log): { pre: string[], messages: string[], post: string[] }
9
- {
10
- let pre: string[] = [];
11
- let messages: string[] = [];
12
- let post: string[] = [];
13
- pre.push(this.qoute(this.formatDateTime(log.date), 100, '-'));
14
- pre.push("Level: " + LogLevel[log.level]);
15
- messages.push(...this.getMesssages(log.messages));
16
- post.push(this.qoute("", 100, '-'));
17
- post.push("");
18
- return { pre, messages, post };
19
- }
1
+ import { BaseFormatter } from "./BaseFormatter";
2
+ import { IFormatter } from "./IFormatter";
3
+ import { Log } from "./Log";
4
+ import { LogLevel } from "./LogLevel";
5
+
6
+ export class FormatterFull extends BaseFormatter implements IFormatter
7
+ {
8
+ format(log: Log): { pre: string[], messages: string[], post: string[] }
9
+ {
10
+ let pre: string[] = [];
11
+ let messages: string[] = [];
12
+ let post: string[] = [];
13
+ pre.push(this.qoute(this.formatDateTime(log.date), 100, '-'));
14
+ pre.push("Level: " + LogLevel[log.level]);
15
+ messages.push(...this.getMesssages(log.messages));
16
+ post.push(this.qoute("", 100, '-'));
17
+ post.push("");
18
+ return { pre, messages, post };
19
+ }
20
20
  }
@@ -1,13 +1,13 @@
1
- import { BaseFormatter } from "./BaseFormatter";
2
- import { IFormatter } from "./IFormatter";
3
- import { Log } from "./Log";
4
-
5
- export class FormatterShort extends BaseFormatter implements IFormatter
6
- {
7
- format(log: Log): { pre: string[], messages: string[], post: string[] }
8
- {
9
- let ans: string[] = [];
10
- ans.push(this.formatDateTime(log.date) + ": " + this.getMesssages(log.messages).filter(m => m).join(" - "));
11
- return { pre: [], messages: ans, post: [] };
12
- }
1
+ import { BaseFormatter } from "./BaseFormatter";
2
+ import { IFormatter } from "./IFormatter";
3
+ import { Log } from "./Log";
4
+
5
+ export class FormatterShort extends BaseFormatter implements IFormatter
6
+ {
7
+ format(log: Log): { pre: string[], messages: string[], post: string[] }
8
+ {
9
+ let ans: string[] = [];
10
+ ans.push(this.formatDateTime(log.date) + ": " + this.getMesssages(log.messages).filter(m => m).join(" - "));
11
+ return { pre: [], messages: ans, post: [] };
12
+ }
13
13
  }
package/src/IFormatter.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Log } from "./Log";
2
-
3
- export interface IFormatter
4
- {
5
- format(log: Log): { pre: string[], messages: string[], post: string[] };
1
+ import { Log } from "./Log";
2
+
3
+ export interface IFormatter
4
+ {
5
+ format(log: Log): { pre: string[], messages: string[], post: string[] };
6
6
  }
package/src/ILogger.ts CHANGED
@@ -1,18 +1,18 @@
1
- import { LogLevel } from "./LogLevel";
2
-
3
- export interface ILogger
4
- {
5
- log(level: LogLevel, ...messages: any[]): void;
6
- trace(...messages: any[]): void;
7
- verbose(...messages: any[]): void;
8
- debug(...messages: any[]): void;
9
- info(...messages: any[]): void;
10
- success(...messages: any[]): void;
11
- warning(...messages: any[]): void;
12
- error(...messages: any[]): void;
13
- critical(...messages: any[]): void;
14
- fatal(...messages: any[]): void;
15
- onCatchError(error: Error | unknown): void;
16
- onCatchCritical(error: Error | unknown): void;
17
- onCatchFatal(error: Error | unknown): void;
1
+ import { LogLevel } from "./LogLevel";
2
+
3
+ export interface ILogger
4
+ {
5
+ log(level: LogLevel, ...messages: any[]): void;
6
+ trace(...messages: any[]): void;
7
+ verbose(...messages: any[]): void;
8
+ debug(...messages: any[]): void;
9
+ info(...messages: any[]): void;
10
+ success(...messages: any[]): void;
11
+ warning(...messages: any[]): void;
12
+ error(...messages: any[]): void;
13
+ critical(...messages: any[]): void;
14
+ fatal(...messages: any[]): void;
15
+ onCatchError(error: Error | unknown): void;
16
+ onCatchCritical(error: Error | unknown): void;
17
+ onCatchFatal(error: Error | unknown): void;
18
18
  }
package/src/IStream.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Log } from "./Log";
2
- export interface IStream
3
- {
4
- write(log: Log, formated: { pre: string[], messages: string[], post: string[] }): void;
1
+ import { Log } from "./Log";
2
+ export interface IStream
3
+ {
4
+ write(log: Log, formated: { pre: string[], messages: string[], post: string[] }): void;
5
5
  }
package/src/Log.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { LogLevel } from "./LogLevel";
2
-
3
- export class Log
4
- {
5
- date: Date;
6
- level: LogLevel;
7
- messages: any[];
8
- constructor(level: LogLevel, ...messages: any[])
9
- {
10
- this.date = new Date();
11
- this.level = level;
12
- this.messages = messages;
13
- }
1
+ import { LogLevel } from "./LogLevel";
2
+
3
+ export class Log
4
+ {
5
+ date: Date;
6
+ level: LogLevel;
7
+ messages: any[];
8
+ constructor(level: LogLevel, ...messages: any[])
9
+ {
10
+ this.date = new Date();
11
+ this.level = level;
12
+ this.messages = messages;
13
+ }
14
14
  }
package/src/LogLevel.ts CHANGED
@@ -1,12 +1,12 @@
1
- export enum LogLevel
2
- {
3
- Trace = "Trace",
4
- Verbose = "Verbose",
5
- Debug = "Debug",
6
- Info = "Info",
7
- Success = "Success",
8
- Warning = "Warning",
9
- Error = "Error",
10
- Critical = "Critical",
11
- Fatal = "Fatal"
1
+ export enum LogLevel
2
+ {
3
+ Trace = "Trace",
4
+ Verbose = "Verbose",
5
+ Debug = "Debug",
6
+ Info = "Info",
7
+ Success = "Success",
8
+ Warning = "Warning",
9
+ Error = "Error",
10
+ Critical = "Critical",
11
+ Fatal = "Fatal"
12
12
  }
package/src/Logger.ts CHANGED
@@ -1,127 +1,127 @@
1
- import { FormatterFull } from "./FormatterFull";
2
- import { IFormatter } from "./IFormatter";
3
- import { ILogger } from "./ILogger";
4
- import { IStream } from "./IStream";
5
- import { Log } from "./Log";
6
- import { LogLevel } from "./LogLevel";
7
- import { StreamConsole } from "./StreamConsole";
8
-
9
- export class Logger implements ILogger
10
- {
11
- static main: Logger | null = null;
12
- private defaultStream: IStream = new StreamConsole();
13
- private formatter?: IFormatter = new FormatterFull();
14
- private customFormatter: { [level: string]: IFormatter } = {};
15
- private streams: IStream[] = [];
16
- constructor()
17
- {
18
- if (Logger.main == null)
19
- Logger.main = this;
20
- this.setFromatter = this.setFromatter.bind(this);
21
- this.setCustomFormatter = this.setCustomFormatter.bind(this);
22
- this.addStream = this.addStream.bind(this);
23
- this.log = this.log.bind(this);
24
- this.trace = this.trace.bind(this);
25
- this.verbose = this.verbose.bind(this);
26
- this.debug = this.debug.bind(this);
27
- this.info = this.info.bind(this);
28
- this.success = this.success.bind(this);
29
- this.warning = this.warning.bind(this);
30
- this.error = this.error.bind(this);
31
- this.critical = this.critical.bind(this);
32
- this.fatal = this.fatal.bind(this);
33
- this.onCatchError = this.onCatchError.bind(this);
34
- this.onCatchCritical = this.onCatchCritical.bind(this);
35
- this.onCatchFatal = this.onCatchFatal.bind(this);
36
- this.getErrorMessage = this.getErrorMessage.bind(this);
37
- this.getErrorStack = this.getErrorStack.bind(this);
38
- this.initUncought = this.initUncought.bind(this);
39
- }
40
- setFromatter(formatter: IFormatter): void
41
- {
42
- this.formatter = formatter;
43
- }
44
- setCustomFormatter(level: LogLevel, formatter: IFormatter): void
45
- {
46
- this.customFormatter[level] = formatter;
47
- }
48
- addStream(stream: IStream)
49
- {
50
- this.streams.push(stream);
51
- }
52
- log(level: LogLevel, ...messages: any[])
53
- {
54
- let log = new Log(level, ...messages);
55
- let formatted: { pre: string[], messages: string[], post: string[] } = { pre: [], messages: [], post: [] };
56
- let formatter = this.customFormatter[level.toString()] ?? this.formatter;
57
- if (formatter)
58
- formatted = formatter.format(log);
59
- if (this.streams.length == 0)
60
- this.defaultStream.write(log, formatted);
61
- else
62
- this.streams.map(s => s.write(log, formatted));
63
- }
64
- trace(...messages: any[])
65
- {
66
- this.log(LogLevel.Trace, ...messages);
67
- }
68
- verbose(...messages: any[])
69
- {
70
- this.log(LogLevel.Verbose, ...messages);
71
- }
72
- debug(...messages: any[])
73
- {
74
- this.log(LogLevel.Debug, ...messages);
75
- }
76
- info(...messages: any[])
77
- {
78
- this.log(LogLevel.Info, ...messages);
79
- }
80
- success(...messages: any[])
81
- {
82
- this.log(LogLevel.Success, ...messages);
83
- }
84
- warning(...messages: any[])
85
- {
86
- this.log(LogLevel.Warning, ...messages);
87
- }
88
- error(...messages: any[])
89
- {
90
- this.log(LogLevel.Error, ...messages);
91
- }
92
- critical(...messages: any[])
93
- {
94
- this.log(LogLevel.Critical, ...messages);
95
- }
96
- fatal(...messages: any[])
97
- {
98
- this.log(LogLevel.Fatal, ...messages);
99
- }
100
- onCatchError(error: Error | unknown)
101
- {
102
- this.error(this.getErrorMessage(error), this.getErrorStack(error));
103
- }
104
- onCatchCritical(error: Error | unknown)
105
- {
106
- this.critical(this.getErrorMessage(error), this.getErrorStack(error));
107
- }
108
- onCatchFatal(error: Error | unknown)
109
- {
110
- this.fatal(this.getErrorMessage(error), this.getErrorStack(error));
111
- }
112
- protected getErrorMessage(error: Error | unknown): string
113
- {
114
- if (error instanceof Error)
115
- return error.message;
116
- return error + "";
117
- }
118
- protected getErrorStack(error: Error | unknown): string
119
- {
120
- if (error instanceof Error)
121
- return error.stack ?? "";
122
- return error + "";
123
- }
124
- initUncought()
125
- {
126
- }
1
+ import { FormatterFull } from "./FormatterFull";
2
+ import { IFormatter } from "./IFormatter";
3
+ import { ILogger } from "./ILogger";
4
+ import { IStream } from "./IStream";
5
+ import { Log } from "./Log";
6
+ import { LogLevel } from "./LogLevel";
7
+ import { StreamConsole } from "./StreamConsole";
8
+
9
+ export class Logger implements ILogger
10
+ {
11
+ static main: Logger | null = null;
12
+ private defaultStream: IStream = new StreamConsole();
13
+ private formatter?: IFormatter = new FormatterFull();
14
+ private customFormatter: { [level: string]: IFormatter } = {};
15
+ private streams: IStream[] = [];
16
+ constructor()
17
+ {
18
+ if (Logger.main == null)
19
+ Logger.main = this;
20
+ this.setFromatter = this.setFromatter.bind(this);
21
+ this.setCustomFormatter = this.setCustomFormatter.bind(this);
22
+ this.addStream = this.addStream.bind(this);
23
+ this.log = this.log.bind(this);
24
+ this.trace = this.trace.bind(this);
25
+ this.verbose = this.verbose.bind(this);
26
+ this.debug = this.debug.bind(this);
27
+ this.info = this.info.bind(this);
28
+ this.success = this.success.bind(this);
29
+ this.warning = this.warning.bind(this);
30
+ this.error = this.error.bind(this);
31
+ this.critical = this.critical.bind(this);
32
+ this.fatal = this.fatal.bind(this);
33
+ this.onCatchError = this.onCatchError.bind(this);
34
+ this.onCatchCritical = this.onCatchCritical.bind(this);
35
+ this.onCatchFatal = this.onCatchFatal.bind(this);
36
+ this.getErrorMessage = this.getErrorMessage.bind(this);
37
+ this.getErrorStack = this.getErrorStack.bind(this);
38
+ this.initUncought = this.initUncought.bind(this);
39
+ }
40
+ setFromatter(formatter: IFormatter): void
41
+ {
42
+ this.formatter = formatter;
43
+ }
44
+ setCustomFormatter(level: LogLevel, formatter: IFormatter): void
45
+ {
46
+ this.customFormatter[level] = formatter;
47
+ }
48
+ addStream(stream: IStream)
49
+ {
50
+ this.streams.push(stream);
51
+ }
52
+ log(level: LogLevel, ...messages: any[])
53
+ {
54
+ let log = new Log(level, ...messages);
55
+ let formatted: { pre: string[], messages: string[], post: string[] } = { pre: [], messages: [], post: [] };
56
+ let formatter = this.customFormatter[level.toString()] ?? this.formatter;
57
+ if (formatter)
58
+ formatted = formatter.format(log);
59
+ if (this.streams.length == 0)
60
+ this.defaultStream.write(log, formatted);
61
+ else
62
+ this.streams.map(s => s.write(log, formatted));
63
+ }
64
+ trace(...messages: any[])
65
+ {
66
+ this.log(LogLevel.Trace, ...messages);
67
+ }
68
+ verbose(...messages: any[])
69
+ {
70
+ this.log(LogLevel.Verbose, ...messages);
71
+ }
72
+ debug(...messages: any[])
73
+ {
74
+ this.log(LogLevel.Debug, ...messages);
75
+ }
76
+ info(...messages: any[])
77
+ {
78
+ this.log(LogLevel.Info, ...messages);
79
+ }
80
+ success(...messages: any[])
81
+ {
82
+ this.log(LogLevel.Success, ...messages);
83
+ }
84
+ warning(...messages: any[])
85
+ {
86
+ this.log(LogLevel.Warning, ...messages);
87
+ }
88
+ error(...messages: any[])
89
+ {
90
+ this.log(LogLevel.Error, ...messages);
91
+ }
92
+ critical(...messages: any[])
93
+ {
94
+ this.log(LogLevel.Critical, ...messages);
95
+ }
96
+ fatal(...messages: any[])
97
+ {
98
+ this.log(LogLevel.Fatal, ...messages);
99
+ }
100
+ onCatchError(error: Error | unknown)
101
+ {
102
+ this.error(this.getErrorMessage(error), this.getErrorStack(error));
103
+ }
104
+ onCatchCritical(error: Error | unknown)
105
+ {
106
+ this.critical(this.getErrorMessage(error), this.getErrorStack(error));
107
+ }
108
+ onCatchFatal(error: Error | unknown)
109
+ {
110
+ this.fatal(this.getErrorMessage(error), this.getErrorStack(error));
111
+ }
112
+ protected getErrorMessage(error: Error | unknown): string
113
+ {
114
+ if (error instanceof Error)
115
+ return error.message;
116
+ return error + "";
117
+ }
118
+ protected getErrorStack(error: Error | unknown): string
119
+ {
120
+ if (error instanceof Error)
121
+ return error.stack ?? "";
122
+ return error + "";
123
+ }
124
+ initUncought()
125
+ {
126
+ }
127
127
  }