metalog 4.0.0-prerelease → 4.0.2-prerelease
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/metalog.js +7 -7
- package/package.json +7 -7
package/metalog.js
CHANGED
|
@@ -358,8 +358,8 @@ class Logger extends EventEmitter {
|
|
|
358
358
|
this.#options = options;
|
|
359
359
|
const { workerId, createStream, keepDays, home, crash, json } = options;
|
|
360
360
|
const { toFile = LOG_TAGS, toStdout = LOG_TAGS } = options;
|
|
361
|
-
this.path = options.path;
|
|
362
|
-
this.home = home;
|
|
361
|
+
this.path = path.resolve(options.path);
|
|
362
|
+
this.home = home ? path.resolve(home) : undefined;
|
|
363
363
|
this.console = new Console(this);
|
|
364
364
|
if (workerId) this.#worker = `W${workerId}`;
|
|
365
365
|
if (toFile) this.#toFile = logTags(toFile);
|
|
@@ -369,7 +369,8 @@ class Logger extends EventEmitter {
|
|
|
369
369
|
if (crash === 'flush') this.#setupCrashHandling();
|
|
370
370
|
this.#fsEnabled = toFile.length !== 0;
|
|
371
371
|
this.#buffer = null;
|
|
372
|
-
|
|
372
|
+
const formatterOptions = { json, worker: this.#worker, home: this.home };
|
|
373
|
+
this.#formatter = new Formatter(formatterOptions);
|
|
373
374
|
return this.open();
|
|
374
375
|
}
|
|
375
376
|
|
|
@@ -449,12 +450,11 @@ class Logger extends EventEmitter {
|
|
|
449
450
|
if (metautil.fileExt(fileName) !== 'log') continue;
|
|
450
451
|
const fileAge = now - nameToDays(fileName);
|
|
451
452
|
if (fileAge < this.#keepDays) continue;
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
.catch(() => {});
|
|
453
|
+
const filePath = path.join(this.path, fileName);
|
|
454
|
+
const promise = fsp.unlink(filePath).catch(() => {});
|
|
455
455
|
finish.push(promise);
|
|
456
456
|
}
|
|
457
|
-
await Promise.
|
|
457
|
+
await Promise.allSettled(finish);
|
|
458
458
|
} catch (error) {
|
|
459
459
|
process.stdout.write(`${error.stack}\n`);
|
|
460
460
|
this.emit('error', error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metalog",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2-prerelease",
|
|
4
4
|
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",
|
|
5
5
|
"description": "Logger for Metarhia",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"node": ">=18"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"concolor": "^1.1.
|
|
56
|
-
"metautil": "^5.
|
|
55
|
+
"concolor": "^1.1.4",
|
|
56
|
+
"metautil": "^5.4.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"eslint": "^9.
|
|
61
|
-
"eslint-config-metarhia": "^9.1.
|
|
62
|
-
"prettier": "^3.
|
|
59
|
+
"@types/node": "^25.0.3",
|
|
60
|
+
"eslint": "^9.39.2",
|
|
61
|
+
"eslint-config-metarhia": "^9.1.5",
|
|
62
|
+
"prettier": "^3.7.4",
|
|
63
63
|
"typescript": "^5.9.2"
|
|
64
64
|
}
|
|
65
65
|
}
|