@akc42/server-utils 3.4.0 → 3.4.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/debug.js +5 -3
- package/package.json +1 -1
package/debug.js
CHANGED
|
@@ -51,12 +51,14 @@ export function Debug (topic) {
|
|
|
51
51
|
logLine += output;
|
|
52
52
|
//eslint-disable-next-line no-console
|
|
53
53
|
console.log(logLine);
|
|
54
|
-
}
|
|
55
|
-
|
|
54
|
+
}
|
|
55
|
+
const time = chalk.whiteBright(new Date().toISOString().substring(11,23)); //store millisecond timing
|
|
56
|
+
cache.push(`${time} ${output}`);
|
|
56
57
|
if (cache.length > cachelimit) cache.splice(0,cache.length - cachelimit); //prevent it getting too big
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
60
|
export function dumpDebugCache() {
|
|
61
|
+
const time = chalk.whiteBright(new Date().toISOString());
|
|
60
62
|
const output = chalk.white.bgBlue('Above are all the debug calls (most recent first) which lead up to, and then followed on from, the error above');
|
|
61
63
|
cache.reverse();
|
|
62
64
|
for(const line of cache) {
|
|
@@ -65,7 +67,7 @@ export function dumpDebugCache() {
|
|
|
65
67
|
}
|
|
66
68
|
cache.reverse();
|
|
67
69
|
//eslint-disable-next-line no-console
|
|
68
|
-
console.log(output);
|
|
70
|
+
console.log(`${time} - ${output}`);
|
|
69
71
|
};
|
|
70
72
|
export function setDebugConfig(con, limit = 50) {
|
|
71
73
|
cachelimit = limit;
|