metalog 3.1.6 → 3.1.7

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased][unreleased]
4
4
 
5
+ ## [3.1.7][] - 2022-03-17
6
+
7
+ - Fix unlink empty files
8
+ - Improve error handling
9
+ - Update dependencies and package maintenance
10
+
5
11
  ## [3.1.6][] - 2021-12-08
6
12
 
7
13
  - Fix typings
@@ -58,7 +64,8 @@
58
64
 
59
65
  First generation of Metarhia Logger
60
66
 
61
- [unreleased]: https://github.com/metarhia/metalog/compare/v3.1.6...HEAD
67
+ [unreleased]: https://github.com/metarhia/metalog/compare/v3.1.7...HEAD
68
+ [3.1.7]: https://github.com/metarhia/metalog/compare/v3.1.6...v3.1.7
62
69
  [3.1.6]: https://github.com/metarhia/metalog/compare/v3.1.5...v3.1.6
63
70
  [3.1.5]: https://github.com/metarhia/metalog/compare/v3.1.4...v3.1.5
64
71
  [3.1.4]: https://github.com/metarhia/metalog/compare/v3.1.3...v3.1.4
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017-2021 Metarhia
3
+ Copyright (c) 2017-2022 Metarhia
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # Meta Logger for Metarhia
2
2
 
3
3
  [![ci status](https://github.com/metarhia/metalog/workflows/Testing%20CI/badge.svg)](https://github.com/metarhia/metalog/actions?query=workflow%3A%22Testing+CI%22+branch%3Amaster)
4
- [![codacy](https://api.codacy.com/project/badge/Grade/7aaad5ed17c74634855fa6202a03a56e)](https://www.codacy.com/app/metarhia/metalog)
5
4
  [![snyk](https://snyk.io/test/github/metarhia/impress/badge.svg)](https://snyk.io/test/github/metarhia/impress)
6
5
  [![npm version](https://img.shields.io/npm/v/metalog.svg?style=flat)](https://www.npmjs.com/package/metalog)
7
6
  [![npm downloads/month](https://img.shields.io/npm/dm/metalog.svg)](https://www.npmjs.com/package/metalog)
@@ -31,6 +30,6 @@ await logger.close();
31
30
 
32
31
  ## License & Contributors
33
32
 
34
- Copyright (c) 2017-2021 [Metarhia contributors](https://github.com/metarhia/metalog/graphs/contributors).
33
+ Copyright (c) 2017-2022 [Metarhia contributors](https://github.com/metarhia/metalog/graphs/contributors).
35
34
  Metalog is [MIT licensed](./LICENSE).\
36
35
  Metalog is a part of [Metarhia](https://github.com/metarhia) technology stack.
package/metalog.js CHANGED
@@ -224,7 +224,8 @@ class Logger extends events.EventEmitter {
224
224
  resolve();
225
225
  return;
226
226
  }
227
- this.emit(new Error(`Can not create directory: ${this.path}\n`));
227
+ const error = new Error(`Can not create directory: ${this.path}\n`);
228
+ this.emit('error', error);
228
229
  reject();
229
230
  });
230
231
  });
@@ -246,7 +247,10 @@ class Logger extends events.EventEmitter {
246
247
  this.once('close', () => {
247
248
  this.open();
248
249
  });
249
- this.close();
250
+ this.close().catch((err) => {
251
+ process.stdout.write(`${err.stack}\n`);
252
+ this.emit('error', err);
253
+ });
250
254
  }, nextReopen);
251
255
  if (this.keepDays) await this.rotate();
252
256
  const options = { flags: 'a', bufferSize: this.writeBuffer };
@@ -278,8 +282,6 @@ class Logger extends events.EventEmitter {
278
282
  return new Promise((resolve, reject) => {
279
283
  this.flush((err) => {
280
284
  if (err) {
281
- process.stdout.write(`${err.stack}\n`);
282
- this.emit('error', err);
283
285
  reject(err);
284
286
  return;
285
287
  }
@@ -291,11 +293,11 @@ class Logger extends events.EventEmitter {
291
293
  this.reopenTimer = null;
292
294
  const fileName = this.file;
293
295
  this.emit('close');
294
- resolve();
295
296
  fs.stat(fileName, (err, stats) => {
296
297
  if (!err && stats.size === 0) {
297
298
  fsp.unlink(fileName).catch(() => {});
298
299
  }
300
+ resolve();
299
301
  });
300
302
  });
301
303
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metalog",
3
- "version": "3.1.6",
3
+ "version": "3.1.7",
4
4
  "author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",
5
5
  "description": "Logger for Metarhia",
6
6
  "license": "MIT",
@@ -49,21 +49,21 @@
49
49
  "fmt": "prettier --write \"**/*.js\" \"**/*.json\" \"**/*.md\" \"**/.*rc\" \"**/*.ts\""
50
50
  },
51
51
  "engines": {
52
- "node": "^12.10 || 14 || 16"
52
+ "node": "^12.10 || 14 || 16 || 17"
53
53
  },
54
54
  "dependencies": {
55
55
  "concolor": "^1.0.2",
56
- "metautil": "^3.5.16"
56
+ "metautil": "^3.5.19"
57
57
  },
58
58
  "devDependencies": {
59
- "@types/node": "^16.10.3",
60
- "eslint": "^7.32.0",
59
+ "@types/node": "^17.0.21",
60
+ "eslint": "^8.11.0",
61
61
  "eslint-config-metarhia": "^7.0.0",
62
- "eslint-config-prettier": "^8.3.0",
63
- "eslint-plugin-import": "^2.24.2",
62
+ "eslint-config-prettier": "^8.5.0",
63
+ "eslint-plugin-import": "^2.25.4",
64
64
  "eslint-plugin-prettier": "^4.0.0",
65
- "metatests": "^0.7.2",
66
- "prettier": "^2.4.1",
67
- "typescript": "^4.4.3"
65
+ "metatests": "^0.8.2",
66
+ "prettier": "^2.6.0",
67
+ "typescript": "^4.6.2"
68
68
  }
69
69
  }