Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metalog

Package Overview
Dependencies
Maintainers
5
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metalog - npm Package Compare versions

Comparing version 3.0.0-alpha.0 to 3.0.0-alpha.1

CHANGELOG.md

28

metalog.js
'use strict';
const fs = require('fs');
const { sep } = require('path');
const path = require('path');
const events = require('events');

@@ -62,2 +62,11 @@ const common = require('@metarhia/common');

const getDateTime = () => {
const now = new Date();
const year = now.getUTCFullYear();
const month = now.getUTCMonth();
const day = now.getUTCDate();
const date = new Date(year, month, day, 0, 0, 0, 0);
return date.getTime();
};
class Logger extends events.EventEmitter {

@@ -75,7 +84,7 @@ // path <string> log directory

super();
const { path, workerId = 0, Writable = WritableFileStream } = options;
const { workerId = 0, Writable = WritableFileStream } = options;
const { writeInterval, writeBuffer, keepDays, home } = options;
const { toFile, toStdout } = options;
this.active = false;
this.path = path;
this.path = options.path;
this.workerId = `W${workerId}`;

@@ -107,4 +116,4 @@ this.Writable = Writable;

}
const date = common.nowDate();
this.file = this.path + sep + date + '-' + this.workerId + '.log';
const fileName = common.nowDate() + '-' + this.workerId + '.log';
this.file = path.join(this.path, fileName);
const now = new Date();

@@ -181,8 +190,3 @@ const nextDate = new Date();

}
const now = new Date();
const year = now.getUTCFullYear();
const month = now.getUTCMonth();
const day = now.getUTCDate();
const date = new Date(year, month, day, 0, 0, 0, 0);
const time = date.getTime();
const time = getDateTime();
for (const fileName of files) {

@@ -192,3 +196,3 @@ const fileTime = new Date(fileName.substring(0, 10)).getTime();

if (fileAge > 1 && fileAge > this.keepDays - 1) {
fs.unlink(this.path + sep + fileName, err => {
fs.unlink(path.join(this.path, fileName), err => {
if (err) {

@@ -195,0 +199,0 @@ process.stdout.write(`${err.stack}\n`);

{
"name": "metalog",
"version": "3.0.0-alpha.0",
"version": "3.0.0-alpha.1",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -38,3 +38,3 @@ "description": "Logger for Metarhia",

"engines": {
"node": ">=10.16.0"
"node": "^12.10 || 14 || 15"
},

@@ -47,3 +47,3 @@ "dependencies": {

"devDependencies": {
"eslint": "^7.12.1",
"eslint": "^7.14.0",
"eslint-config-metarhia": "^7.0.0",

@@ -54,4 +54,4 @@ "eslint-config-prettier": "^6.15.0",

"metatests": "^0.7.2",
"prettier": "^2.1.2"
"prettier": "^2.2.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc