Comparing version 2.2.1 to 3.0.0-alpha.0
'use strict'; | ||
const fs = require('fs'); | ||
const { sep } = require('path'); | ||
const events = require('events'); | ||
@@ -83,3 +84,3 @@ const common = require('@metarhia/common'); | ||
this.keepDays = keepDays || 0; | ||
this.home = home ? new RegExp(home, 'g') : null; | ||
this.home = home ? new RegExp(common.escapeRegExp(home), 'g') : null; | ||
this.options = { flags: 'a', bufferSize: this.writeBuffer }; | ||
@@ -106,3 +107,3 @@ this.stream = null; | ||
const date = common.nowDate(); | ||
this.file = `${this.path}/${date}-${this.workerId}.log`; | ||
this.file = this.path + sep + date + '-' + this.workerId + '.log'; | ||
const now = new Date(); | ||
@@ -189,3 +190,3 @@ const nextDate = new Date(); | ||
if (fileAge > 1 && fileAge > this.keepDays - 1) { | ||
fs.unlink(this.path + '/' + fileName, err => { | ||
fs.unlink(this.path + sep + fileName, err => { | ||
if (err) { | ||
@@ -294,2 +295,4 @@ process.stdout.write(`${err.stack}\n`); | ||
module.exports = args => new Logger(args); | ||
const openLog = async args => new Logger(args); | ||
module.exports = { Logger, openLog }; |
{ | ||
"name": "metalog", | ||
"version": "2.2.1", | ||
"version": "3.0.0-alpha.0", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -42,14 +42,14 @@ "description": "Logger for Metarhia", | ||
"@metarhia/common": "^2.1.0", | ||
"concolor": "^0.1.15", | ||
"concolor": "^0.1.16", | ||
"metastreams": "^0.1.2" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^7.7.0", | ||
"eslint": "^7.12.1", | ||
"eslint-config-metarhia": "^7.0.0", | ||
"eslint-config-prettier": "^6.9.0", | ||
"eslint-plugin-import": "^2.20.0", | ||
"eslint-config-prettier": "^6.15.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"prettier": "^2.0.5", | ||
"metatests": "^0.7.2" | ||
"metatests": "^0.7.2", | ||
"prettier": "^2.1.2" | ||
} | ||
} |
# Meta Logger for Metarhia | ||
[![travis](https://travis-ci.org/metarhia/metalog.svg?branch=master)](https://travis-ci.org/metarhia/metalog) | ||
[![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) | ||
@@ -5,0 +5,0 @@ [![npm version](https://img.shields.io/npm/v/metalog.svg?style=flat)](https://www.npmjs.com/package/metalog) |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
11243
269
2
Updatedconcolor@^0.1.16