node-logy 0.1.1 → 0.1.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.
- package/dist/logger.d.ts +256 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +688 -0
- package/dist/logger.js.map +1 -0
- package/dist/protocol.d.ts +286 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +414 -0
- package/dist/protocol.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +257 -0
- package/dist/server.js.map +1 -0
- package/package.json +1 -1
- package/dist/index.d.ts +0 -99
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -363
- package/dist/index.js.map +0 -1
- package/dist/node_process.d.ts +0 -5
- package/dist/node_process.d.ts.map +0 -1
- package/dist/node_process.js +0 -247
- package/dist/node_process.js.map +0 -1
- package/dist/types.d.ts +0 -88
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,0DAA6B;AAC7B,yCAOoB;AACpB,sDAAyB;AAEzB;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;GAEG;AACH,IAAI,UAAU,GAA0B,IAAI,CAAC;AAE7C;;GAEG;AACH,IAAI,QAAQ,GAAG,QAAQ,CAAC;AAExB;;GAEG;AACH,IAAI,WAAW,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1C;;GAEG;AACH,IAAI,oBAAoB,GAAa,EAAE,CAAC;AAExC;;GAEG;AACH,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB;;GAEG;AACH,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAE1C;;GAEG;AACH,IAAI,YAAY,GAA0B,IAAI,CAA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A0B,EAAE,EAAE;QACtD,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QAClD,WAAW,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;QAC3B,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-logy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A lightweight Node.js logging utility that outputs logs to the console and writes them to rotating log files. Supports different log levels, timestamps, and customizable formatting for production-ready applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
package/dist/index.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import type types = require("./types");
|
|
2
|
-
/**
|
|
3
|
-
* Represents a logger used to log to node's stdout console and also save logs to log files.
|
|
4
|
-
* Uses a seperate process that writes to log file while the main logger in your application process is non blocking
|
|
5
|
-
*/
|
|
6
|
-
declare class NodeLogger {
|
|
7
|
-
/**
|
|
8
|
-
* Holds the options passed to the logger
|
|
9
|
-
*/
|
|
10
|
-
private _options;
|
|
11
|
-
/**
|
|
12
|
-
* Holds ref to the go binary that we write to the stdin of
|
|
13
|
-
*/
|
|
14
|
-
private _spawnRef;
|
|
15
|
-
/**
|
|
16
|
-
* Indicates if flush has been sent
|
|
17
|
-
*/
|
|
18
|
-
private _isFlushing;
|
|
19
|
-
/**
|
|
20
|
-
* Tracks the UTC date (YYYY-MM-DD) to handle daily file rotation
|
|
21
|
-
*/
|
|
22
|
-
private _currentDateStr;
|
|
23
|
-
/**
|
|
24
|
-
* Pass additional options on initialization to change the logger's behaviour
|
|
25
|
-
* @param options Change the behaviour of the logger
|
|
26
|
-
*/
|
|
27
|
-
constructor(options?: Partial<types.NodeLoggerOptions>);
|
|
28
|
-
/**
|
|
29
|
-
* Helper to format a date into a UTC YYYY-MM-DD string
|
|
30
|
-
*/
|
|
31
|
-
private getUtcDateString;
|
|
32
|
-
/**
|
|
33
|
-
* Checks if the UTC day has changed
|
|
34
|
-
*/
|
|
35
|
-
private checkDateRotation;
|
|
36
|
-
/**
|
|
37
|
-
* Trys to find the `node_process` file which spawn the protcol handler
|
|
38
|
-
* @returns The path to the file or undefined
|
|
39
|
-
*/
|
|
40
|
-
private findNodeProcessFile;
|
|
41
|
-
/**
|
|
42
|
-
* Log information
|
|
43
|
-
* @param level The specific level of log message
|
|
44
|
-
* @param content A message or error object or object
|
|
45
|
-
* @param contents Any other messages or error objects
|
|
46
|
-
*/
|
|
47
|
-
private log;
|
|
48
|
-
/**
|
|
49
|
-
* Logs an informational message to the console
|
|
50
|
-
* @param message The message to log
|
|
51
|
-
* @param messages Any other message objects or error objects
|
|
52
|
-
*/
|
|
53
|
-
info(message: unknown, ...messages: unknown[]): void;
|
|
54
|
-
/**
|
|
55
|
-
* Logs a warning message to the console
|
|
56
|
-
* @param message The message to log
|
|
57
|
-
* @param messages Any other message objects or error objects
|
|
58
|
-
*/
|
|
59
|
-
warn(message: unknown, ...messages: unknown[]): void;
|
|
60
|
-
/**
|
|
61
|
-
* Logs an error message to the console.
|
|
62
|
-
* It is recommended you pass the actual error object so we can print as much information as possible.
|
|
63
|
-
*
|
|
64
|
-
* For example:
|
|
65
|
-
*
|
|
66
|
-
* ```ts
|
|
67
|
-
* logger.error(new Error(""));
|
|
68
|
-
* ```
|
|
69
|
-
* @param messageOrError The error object or message to log
|
|
70
|
-
* @param messages Any other message objects or error objects
|
|
71
|
-
*/
|
|
72
|
-
error(messageOrError: unknown, ...messages: unknown[]): void;
|
|
73
|
-
/**
|
|
74
|
-
* Used to write any remaning logs to the stdin and close the sidecar logger - NEEDS to be called on app exit or on app cleanup
|
|
75
|
-
* as if not it will keep the app alive and wait for flush command
|
|
76
|
-
*/
|
|
77
|
-
flush(): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
* Captures the stack trace of the caller of the logger (not the logger itself)
|
|
80
|
-
*/
|
|
81
|
-
private getLogCallStack;
|
|
82
|
-
/**
|
|
83
|
-
* Write to the stdin of the process in the protocol defined
|
|
84
|
-
* @param request The request payload
|
|
85
|
-
*/
|
|
86
|
-
private writeToStdin;
|
|
87
|
-
/**
|
|
88
|
-
* Extracts as much information as possible from an error or object or any other type and returns it as a string, if it has multiple fields to it
|
|
89
|
-
* then they will be serpated by new lines
|
|
90
|
-
* @param object The error object or any object to extract information from
|
|
91
|
-
* @returns A detailed string representation of the error/object
|
|
92
|
-
*/
|
|
93
|
-
private extractInfo;
|
|
94
|
-
}
|
|
95
|
-
declare const _default: {
|
|
96
|
-
NodeLogger: typeof NodeLogger;
|
|
97
|
-
};
|
|
98
|
-
export = _default;
|
|
99
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,KAAK,GAAG,QAAQ,SAAS,CAAC,CAAC;AAwBvC;;;GAGG;AACH,cAAM,UAAU;IACd;;OAEG;IACH,OAAO,CAAC,QAAQ,CAA0B;IAE1C;;OAEG;IACH,OAAO,CAAC,SAAS,CAA6D;IAE9E;;OAEG;IACH,OAAO,CAAC,WAAW,CAAS;IAE5B;;OAEG;IACH,OAAO,CAAC,eAAe,CAAS;IAEhC;;;OAGG;gBACS,OAAO,GAAE,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAkB;IA6CtE;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAOxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;;;;OAKG;IACH,OAAO,CAAC,GAAG;IAoDX;;;;OAIG;IACI,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE;IAIpD;;;;OAIG;IACI,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE;IAIpD;;;;;;;;;;;OAWG;IACI,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,GAAG,QAAQ,EAAE,OAAO,EAAE;IAI5D;;;OAGG;IACI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAiC7B;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;;OAGG;IACH,OAAO,CAAC,YAAY;IA6BpB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;CA2FpB;;;;AAED,kBAEE"}
|
package/dist/index.js
DELETED
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const child_process = require("node:child_process");
|
|
3
|
-
const path = require("node:path");
|
|
4
|
-
const fs = require("fs");
|
|
5
|
-
/**
|
|
6
|
-
* ANSI Escape Codes for terminal colors
|
|
7
|
-
*/
|
|
8
|
-
const ANSI_RESET = "\x1b[0m";
|
|
9
|
-
/**
|
|
10
|
-
* Holds default options for the logger
|
|
11
|
-
*/
|
|
12
|
-
const defaultOptions = {
|
|
13
|
-
logFilesBasePath: "./logs",
|
|
14
|
-
saveToLogFile: true,
|
|
15
|
-
showLogTime: true,
|
|
16
|
-
useAnsiColors: true,
|
|
17
|
-
colorMap: {
|
|
18
|
-
INFO: "\x1b[32m", // Green
|
|
19
|
-
WARN: "\x1b[33m", // Yellow
|
|
20
|
-
ERROR: "\x1b[31m", // Red
|
|
21
|
-
},
|
|
22
|
-
showConsoleOutput: true,
|
|
23
|
-
showStackTraceOfLogCalls: false,
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Represents a logger used to log to node's stdout console and also save logs to log files.
|
|
27
|
-
* Uses a seperate process that writes to log file while the main logger in your application process is non blocking
|
|
28
|
-
*/
|
|
29
|
-
class NodeLogger {
|
|
30
|
-
/**
|
|
31
|
-
* Holds the options passed to the logger
|
|
32
|
-
*/
|
|
33
|
-
_options;
|
|
34
|
-
/**
|
|
35
|
-
* Holds ref to the go binary that we write to the stdin of
|
|
36
|
-
*/
|
|
37
|
-
_spawnRef = null;
|
|
38
|
-
/**
|
|
39
|
-
* Indicates if flush has been sent
|
|
40
|
-
*/
|
|
41
|
-
_isFlushing = false;
|
|
42
|
-
/**
|
|
43
|
-
* Tracks the UTC date (YYYY-MM-DD) to handle daily file rotation
|
|
44
|
-
*/
|
|
45
|
-
_currentDateStr;
|
|
46
|
-
/**
|
|
47
|
-
* Pass additional options on initialization to change the logger's behaviour
|
|
48
|
-
* @param options Change the behaviour of the logger
|
|
49
|
-
*/
|
|
50
|
-
constructor(options = defaultOptions) {
|
|
51
|
-
const mergedColorMap = { ...defaultOptions.colorMap, ...options.colorMap };
|
|
52
|
-
this._options = { ...defaultOptions, ...options, colorMap: mergedColorMap };
|
|
53
|
-
this._currentDateStr = this.getUtcDateString(new Date());
|
|
54
|
-
if (typeof this._options !== "object") {
|
|
55
|
-
throw new TypeError("Options passed cannot be null or undefined; it must be an object");
|
|
56
|
-
}
|
|
57
|
-
if (typeof this._options.logFilesBasePath !== "string" ||
|
|
58
|
-
(typeof this._options.logFilesBasePath === "string" &&
|
|
59
|
-
this._options.logFilesBasePath.trim() === "")) {
|
|
60
|
-
throw new TypeError("logFilesBasePath must be a non-empty string");
|
|
61
|
-
}
|
|
62
|
-
if (typeof this._options.saveToLogFile !== "boolean") {
|
|
63
|
-
throw new TypeError("saveToLogFile must be a boolean");
|
|
64
|
-
}
|
|
65
|
-
if (typeof this._options.showLogTime !== "boolean") {
|
|
66
|
-
throw new TypeError("showLogTime must be a boolean");
|
|
67
|
-
}
|
|
68
|
-
this._options.logFilesBasePath = path.resolve(this._options.logFilesBasePath);
|
|
69
|
-
if (this._options.saveToLogFile) {
|
|
70
|
-
let process_path = this.findNodeProcessFile();
|
|
71
|
-
if (!process_path) {
|
|
72
|
-
throw new Error("Failed ot find node_process file");
|
|
73
|
-
}
|
|
74
|
-
this._spawnRef = child_process.spawn("node", [
|
|
75
|
-
process_path,
|
|
76
|
-
`--basePath=${this._options.logFilesBasePath}`,
|
|
77
|
-
]); // we are spawing a js file so we use node
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Helper to format a date into a UTC YYYY-MM-DD string
|
|
82
|
-
*/
|
|
83
|
-
getUtcDateString(date) {
|
|
84
|
-
const y = date.getUTCFullYear();
|
|
85
|
-
const m = String(date.getUTCMonth() + 1).padStart(2, "0");
|
|
86
|
-
const d = String(date.getUTCDate()).padStart(2, "0");
|
|
87
|
-
return `${y}-${m}-${d}`;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Checks if the UTC day has changed
|
|
91
|
-
*/
|
|
92
|
-
checkDateRotation() {
|
|
93
|
-
const nowUtcStr = this.getUtcDateString(new Date());
|
|
94
|
-
if (nowUtcStr !== this._currentDateStr) {
|
|
95
|
-
this._currentDateStr = nowUtcStr;
|
|
96
|
-
this.writeToStdin({
|
|
97
|
-
id: Date.now(),
|
|
98
|
-
method: "reload",
|
|
99
|
-
data: null,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Trys to find the `node_process` file which spawn the protcol handler
|
|
105
|
-
* @returns The path to the file or undefined
|
|
106
|
-
*/
|
|
107
|
-
findNodeProcessFile() {
|
|
108
|
-
try {
|
|
109
|
-
const files = fs.readdirSync(__dirname);
|
|
110
|
-
const match = files.find((file) => file === "node_process.js");
|
|
111
|
-
return match ? path.join(__dirname, match) : undefined;
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Log information
|
|
119
|
-
* @param level The specific level of log message
|
|
120
|
-
* @param content A message or error object or object
|
|
121
|
-
* @param contents Any other messages or error objects
|
|
122
|
-
*/
|
|
123
|
-
log(level, content, ...contents) {
|
|
124
|
-
const now = new Date();
|
|
125
|
-
const logParts = [];
|
|
126
|
-
if (this._options.saveToLogFile) {
|
|
127
|
-
this.checkDateRotation();
|
|
128
|
-
}
|
|
129
|
-
const callStack = this.getLogCallStack();
|
|
130
|
-
if (callStack) {
|
|
131
|
-
logParts.push(callStack);
|
|
132
|
-
}
|
|
133
|
-
if (this._options.showLogTime) {
|
|
134
|
-
const timestamp = now.toUTCString();
|
|
135
|
-
logParts.push(`[${timestamp}]`);
|
|
136
|
-
}
|
|
137
|
-
logParts.push(`[${level}]`);
|
|
138
|
-
let message = `${this.extractInfo(content)}`;
|
|
139
|
-
contents.forEach((m) => {
|
|
140
|
-
message += ` ${this.extractInfo(m)}`;
|
|
141
|
-
});
|
|
142
|
-
logParts.push(message);
|
|
143
|
-
let fullConsoleMessage = logParts.join(" ");
|
|
144
|
-
if (this._options.useAnsiColors) {
|
|
145
|
-
const colorCode = this._options.colorMap[level];
|
|
146
|
-
if (colorCode) {
|
|
147
|
-
fullConsoleMessage = `${colorCode}${fullConsoleMessage}${ANSI_RESET}`;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (this._options.showConsoleOutput) {
|
|
151
|
-
if (level === "ERROR")
|
|
152
|
-
console.error(fullConsoleMessage);
|
|
153
|
-
else if (level === "WARN")
|
|
154
|
-
console.warn(fullConsoleMessage);
|
|
155
|
-
else
|
|
156
|
-
console.log(fullConsoleMessage);
|
|
157
|
-
}
|
|
158
|
-
if (this._options.saveToLogFile) {
|
|
159
|
-
const fileTime = this._options.showLogTime ? now.toUTCString() : "";
|
|
160
|
-
const data = `${fileTime} ${level} ${message}`;
|
|
161
|
-
this.writeToStdin({
|
|
162
|
-
method: "log",
|
|
163
|
-
data,
|
|
164
|
-
id: 1,
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Logs an informational message to the console
|
|
170
|
-
* @param message The message to log
|
|
171
|
-
* @param messages Any other message objects or error objects
|
|
172
|
-
*/
|
|
173
|
-
info(message, ...messages) {
|
|
174
|
-
this.log("INFO", message, ...messages);
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Logs a warning message to the console
|
|
178
|
-
* @param message The message to log
|
|
179
|
-
* @param messages Any other message objects or error objects
|
|
180
|
-
*/
|
|
181
|
-
warn(message, ...messages) {
|
|
182
|
-
this.log("WARN", message, ...messages);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Logs an error message to the console.
|
|
186
|
-
* It is recommended you pass the actual error object so we can print as much information as possible.
|
|
187
|
-
*
|
|
188
|
-
* For example:
|
|
189
|
-
*
|
|
190
|
-
* ```ts
|
|
191
|
-
* logger.error(new Error(""));
|
|
192
|
-
* ```
|
|
193
|
-
* @param messageOrError The error object or message to log
|
|
194
|
-
* @param messages Any other message objects or error objects
|
|
195
|
-
*/
|
|
196
|
-
error(messageOrError, ...messages) {
|
|
197
|
-
this.log("ERROR", messageOrError, ...messages);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Used to write any remaning logs to the stdin and close the sidecar logger - NEEDS to be called on app exit or on app cleanup
|
|
201
|
-
* as if not it will keep the app alive and wait for flush command
|
|
202
|
-
*/
|
|
203
|
-
flush() {
|
|
204
|
-
if (this._isFlushing || !this._options.saveToLogFile)
|
|
205
|
-
return Promise.resolve();
|
|
206
|
-
this._isFlushing = true;
|
|
207
|
-
return new Promise((resolve, reject) => {
|
|
208
|
-
const timeout = setTimeout(() => {
|
|
209
|
-
this._spawnRef?.removeAllListeners("exit");
|
|
210
|
-
reject(new Error("Flush timed out after 4 seconds: Child process failed to exit."));
|
|
211
|
-
}, 4000);
|
|
212
|
-
this._spawnRef?.on("exit", () => {
|
|
213
|
-
clearTimeout(timeout);
|
|
214
|
-
resolve();
|
|
215
|
-
});
|
|
216
|
-
try {
|
|
217
|
-
this.writeToStdin({
|
|
218
|
-
id: 1,
|
|
219
|
-
method: "flush",
|
|
220
|
-
data: null,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
catch (err) {
|
|
224
|
-
clearTimeout(timeout);
|
|
225
|
-
reject(err);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Captures the stack trace of the caller of the logger (not the logger itself)
|
|
231
|
-
*/
|
|
232
|
-
getLogCallStack() {
|
|
233
|
-
if (!this._options.showStackTraceOfLogCalls)
|
|
234
|
-
return null;
|
|
235
|
-
const err = new Error();
|
|
236
|
-
if (!err.stack)
|
|
237
|
-
return null;
|
|
238
|
-
const lines = err.stack.split("\n");
|
|
239
|
-
return lines[4]?.trim() || null;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Write to the stdin of the process in the protocol defined
|
|
243
|
-
* @param request The request payload
|
|
244
|
-
*/
|
|
245
|
-
writeToStdin(request) {
|
|
246
|
-
if (typeof request !== "object" || request === null) {
|
|
247
|
-
throw new TypeError("request must be an object");
|
|
248
|
-
}
|
|
249
|
-
if (!this._spawnRef || !this._spawnRef.stdin.writable) {
|
|
250
|
-
console.error("Cannot write to stdin process has quit or not yet spawned");
|
|
251
|
-
throw new Error("Cannot write to stdin process has quit or not yet spawned options: " +
|
|
252
|
-
this.extractInfo(this._options));
|
|
253
|
-
}
|
|
254
|
-
const json = JSON.stringify(request);
|
|
255
|
-
const header = `Content-Length: ${Buffer.byteLength(json, "utf8")}\r\n\r\n`;
|
|
256
|
-
const payload = header + json;
|
|
257
|
-
try {
|
|
258
|
-
this._spawnRef.stdin.write(payload);
|
|
259
|
-
}
|
|
260
|
-
catch (error) {
|
|
261
|
-
console.error("Failed to write to node_process");
|
|
262
|
-
console.error(this.extractInfo(error));
|
|
263
|
-
this._spawnRef.kill();
|
|
264
|
-
throw error;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Extracts as much information as possible from an error or object or any other type and returns it as a string, if it has multiple fields to it
|
|
269
|
-
* then they will be serpated by new lines
|
|
270
|
-
* @param object The error object or any object to extract information from
|
|
271
|
-
* @returns A detailed string representation of the error/object
|
|
272
|
-
*/
|
|
273
|
-
extractInfo(object) {
|
|
274
|
-
const parts = [];
|
|
275
|
-
if (object === null)
|
|
276
|
-
return "null";
|
|
277
|
-
if (object === undefined)
|
|
278
|
-
return "undefined";
|
|
279
|
-
const type = typeof object;
|
|
280
|
-
if (type === "symbol") {
|
|
281
|
-
parts.push(`symbol: ${object.toString()}`);
|
|
282
|
-
parts.push(`description: ${object.description}`);
|
|
283
|
-
return parts.join("\n");
|
|
284
|
-
}
|
|
285
|
-
if (type === "boolean" || type === "number" || type === "bigint")
|
|
286
|
-
return `${object}`;
|
|
287
|
-
if (type === "string")
|
|
288
|
-
return object;
|
|
289
|
-
if (type === "function") {
|
|
290
|
-
const fn = object;
|
|
291
|
-
parts.push(`name: ${fn.name || "(anonymous)"}`);
|
|
292
|
-
parts.push(`params (length): ${fn.length}`);
|
|
293
|
-
parts.push(`isAsync: ${fn.constructor.name === "AsyncFunction"}`);
|
|
294
|
-
parts.push(`isGenerator: ${fn.constructor.name === "GeneratorFunction"}`);
|
|
295
|
-
parts.push(`isArrowFunction: ${!fn.hasOwnProperty("prototype")}`);
|
|
296
|
-
parts.push(`hasPrototype: ${!!fn.prototype}`);
|
|
297
|
-
parts.push(`constructor: ${fn.constructor.name}`);
|
|
298
|
-
parts.push(`source: ${fn.toString()}`);
|
|
299
|
-
if (fn.prototype) {
|
|
300
|
-
parts.push(`prototype keys: ${Object.keys(fn.prototype).join(", ") || "(none)"}`);
|
|
301
|
-
}
|
|
302
|
-
return parts.join("\n");
|
|
303
|
-
}
|
|
304
|
-
if (object instanceof Error) {
|
|
305
|
-
const err = object;
|
|
306
|
-
if (err.name)
|
|
307
|
-
parts.push(`Name: ${err.name}`);
|
|
308
|
-
if (err.message)
|
|
309
|
-
parts.push(`Message: ${err.message}`);
|
|
310
|
-
if (err.stack)
|
|
311
|
-
parts.push(`Stack: ${err.stack}`);
|
|
312
|
-
if (err.code)
|
|
313
|
-
parts.push(`Code: ${err.code}`);
|
|
314
|
-
if (err.errno !== undefined)
|
|
315
|
-
parts.push(`Errno: ${err.errno}`);
|
|
316
|
-
if (err.syscall)
|
|
317
|
-
parts.push(`Syscall: ${err.syscall}`);
|
|
318
|
-
if (err.path)
|
|
319
|
-
parts.push(`Path: ${err.path}`);
|
|
320
|
-
if (err.port)
|
|
321
|
-
parts.push(`Port: ${err.port}`);
|
|
322
|
-
if (err.address)
|
|
323
|
-
parts.push(`Address: ${err.address}`);
|
|
324
|
-
if (err.dest)
|
|
325
|
-
parts.push(`Dest: ${err.dest}`);
|
|
326
|
-
// Include any additional custom properties
|
|
327
|
-
for (const key of Object.keys(err)) {
|
|
328
|
-
if (![
|
|
329
|
-
"name",
|
|
330
|
-
"message",
|
|
331
|
-
"stack",
|
|
332
|
-
"code",
|
|
333
|
-
"errno",
|
|
334
|
-
"syscall",
|
|
335
|
-
"path",
|
|
336
|
-
"address",
|
|
337
|
-
"port",
|
|
338
|
-
"errors",
|
|
339
|
-
].includes(key)) {
|
|
340
|
-
parts.push(`${key}: ${err[key]}`);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
if ("errors" in err && Array.isArray(err.errors)) {
|
|
344
|
-
const nested = err.errors
|
|
345
|
-
.map((e, i) => ` [${i}] ${this.extractInfo(e)}`)
|
|
346
|
-
.join("\n");
|
|
347
|
-
parts.push(`Nested Errors:\n${nested}`);
|
|
348
|
-
}
|
|
349
|
-
return parts.join("\n");
|
|
350
|
-
}
|
|
351
|
-
if (type === "object") {
|
|
352
|
-
const obj = object;
|
|
353
|
-
for (const key of Object.keys(obj)) {
|
|
354
|
-
parts.push(`${key}: ${obj[key]}`);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return parts.length > 0 ? parts.join("\n") : "unknown";
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
module.exports = {
|
|
361
|
-
NodeLogger,
|
|
362
|
-
};
|
|
363
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,oDAAqD;AACrD,kCAAmC;AACnC,yBAA0B;AAG1B;;GAEG;AACH,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;GAEG;AACH,MAAM,cAAc,GAA4B;IAC9C,gBAAgB,EAAE,QAAQ;IAC1B,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU,EAAE,QAAQ;QAC1B,IAAI,EAAE,UAAU,EAAE,SAAS;QAC3B,KAAK,EAAE,UAAU,EAAE,MAAM;KAC1B;IACD,iBAAiB,EAAE,IAAI;IACvB,wBAAwB,EAAE,KAAK;CAChC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU;IACd;;OAEG;IACK,QAAQ,CAA0B;IAE1C;;OAEG;IACK,SAAS,GAAwD,IAAI,CAAC;IAE9E;;OAEG;IACK,WAAW,GAAG,KAAK,CAAC;IAE5B;;OAEG;IACK,eAAe,CAAS;IAEhC;;;OAGG;IACH,YAAY,UAA4C,cAAc;QACpE,MAAM,cAAc,GAAG,EAAE,GAAG,cAAc,CAAC,QAAQ,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC3E,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;QAE5E,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QAEzD,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;Y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