Comparing version 3.0.0 to 3.1.0
@@ -5,4 +5,10 @@ # Changelog | ||
To be released in 3.0.0 | ||
## [3.1.0][] - 2021-01-07 | ||
- Use metautil instead of metarhia/common | ||
- Use writable factory instead of constructor | ||
- Use fs.createWriteStream instead of metastreams | ||
## [3.0.0][] - 2020-12-16 | ||
- Change Logger interface, use async/await | ||
@@ -26,4 +32,6 @@ - Console interface implementation | ||
[unreleased]: https://github.com/metarhia/metalog/compare/v2.x...HEAD | ||
[unreleased]: https://github.com/metarhia/metalog/compare/v3.1.0...HEAD | ||
[3.1.0]: https://github.com/metarhia/metalog/compare/v3.0.0...v3.1.0 | ||
[3.0.0]: https://github.com/metarhia/metalog/compare/v2.x...v3.0.0 | ||
[2.x]: https://github.com/metarhia/metalog/compare/v1.x...v2.x | ||
[1.x]: https://github.com/metarhia/metalog/tree/v1.x |
@@ -9,8 +9,7 @@ 'use strict'; | ||
const readline = require('readline'); | ||
const common = require('@metarhia/common'); | ||
const { WritableFileStream } = require('metastreams'); | ||
const metautil = require('metautil'); | ||
const concolor = require('concolor'); | ||
const DAY_MILLISECONDS = common.duration('1d'); | ||
const DEFAULT_WRITE_INTERVAL = common.duration('3s'); | ||
const DAY_MILLISECONDS = metautil.duration('1d'); | ||
const DEFAULT_WRITE_INTERVAL = metautil.duration('3s'); | ||
const DEFAULT_BUFFER_SIZE = 64 * 1024; | ||
@@ -205,7 +204,7 @@ const DEFAULT_KEEP_DAYS = 1; | ||
// toStdout <string[]> write log types to stdout | ||
// Writable <class> writable stream class | ||
// createStream <function> writable stream factory | ||
// home <string> remove home paths from stack traces | ||
constructor(args) { | ||
super(); | ||
const { workerId = 0, Writable = WritableFileStream } = args; | ||
const { workerId = 0, createStream = fs.createWriteStream } = args; | ||
const { writeInterval, writeBuffer, keepDays, home } = args; | ||
@@ -216,3 +215,3 @@ const { toFile, toStdout } = args; | ||
this.workerId = `W${workerId}`; | ||
this.Writable = Writable; | ||
this.createStream = createStream; | ||
this.writeInterval = writeInterval || DEFAULT_WRITE_INTERVAL; | ||
@@ -259,3 +258,3 @@ this.writeBuffer = writeBuffer || DEFAULT_BUFFER_SIZE; | ||
await this.createLogDir(); | ||
const fileName = common.nowDate() + '-' + this.workerId + '.log'; | ||
const fileName = metautil.nowDate() + '-' + this.workerId + '.log'; | ||
this.file = path.join(this.path, fileName); | ||
@@ -271,3 +270,3 @@ const nextReopen = getNextReopen(); | ||
const options = { flags: 'a', bufferSize: this.writeBuffer }; | ||
this.stream = new this.Writable(this.file, options); | ||
this.stream = this.createStream(this.file, options); | ||
this.flushTimer = setInterval(() => { | ||
@@ -331,3 +330,3 @@ this.flush(); | ||
for (const fileName of files) { | ||
if (common.fileExt(fileName) !== 'log') continue; | ||
if (metautil.fileExt(fileName) !== 'log') continue; | ||
const fileAge = now - nameToDays(fileName); | ||
@@ -334,0 +333,0 @@ if (fileAge < this.keepDays) continue; |
{ | ||
"name": "metalog", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -41,5 +41,4 @@ "description": "Logger for Metarhia", | ||
"dependencies": { | ||
"@metarhia/common": "^2.1.0", | ||
"concolor": "^1.0.0", | ||
"metastreams": "^0.1.2" | ||
"metautil": "^3.0.0" | ||
}, | ||
@@ -46,0 +45,0 @@ "devDependencies": { |
# Meta Logger for Metarhia | ||
[![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) | ||
[![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) | ||
[![codacy](https://api.codacy.com/project/badge/Grade/7aaad5ed17c74634855fa6202a03a56e)](https://www.codacy.com/app/metarhia/metalog) | ||
[![snyk](https://snyk.io/test/github/metarhia/impress/badge.svg)](https://snyk.io/test/github/metarhia/impress) | ||
[![npm version](https://img.shields.io/npm/v/metalog.svg?style=flat)](https://www.npmjs.com/package/metalog) | ||
@@ -23,3 +24,3 @@ [![npm downloads/month](https://img.shields.io/npm/dm/metalog.svg)](https://www.npmjs.com/package/metalog) | ||
Copyright (c) 2017-2020 Metarhia contributors. | ||
Copyright (c) 2017-2021 Metarhia contributors. | ||
Metalog is [MIT licensed](./LICENSE). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15555
2
26
358
+ Addedmetautil@^3.0.0
+ Addedmetautil@3.15.0(transitive)
- Removed@metarhia/common@^2.1.0
- Removedmetastreams@^0.1.2
- Removed@metarhia/common@2.2.2(transitive)
- Removedmetastreams@0.1.2(transitive)