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

metalog

Package Overview
Dependencies
Maintainers
4
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 1.0.4 to 1.0.5

.prettierrc

42

metalog.js

@@ -11,3 +11,11 @@ 'use strict';

const LOG_TYPES = [
'system', 'fatal', 'error', 'warn', 'info', 'debug', 'access', 'slow', 'db'
'system',
'fatal',
'error',
'warn',
'info',
'debug',
'access',
'slow',
'db',
];

@@ -58,3 +66,2 @@

class ApplicationLogger {
// logger <Logger>

@@ -105,7 +112,5 @@ // application <string> name

}
}
class Logger extends events.EventEmitter {
// path <string> log directory

@@ -206,3 +211,9 @@ // node <string> nodeId

const date = new Date(
now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 0, 0, 0, 0
now.getUTCFullYear(),
now.getUTCMonth(),
now.getUTCDate(),
0,
0,
0,
0
);

@@ -237,3 +248,3 @@ const time = date.getTime();

const time = date.toISOString();
const multiline = (/[\n\r]/g).test(message);
const multiline = /[\n\r]/g.test(message);
const line = multiline ? lineStack(message) : message;

@@ -247,12 +258,22 @@ const data = `${time} [${type}] ${this.node}/${application} ${line}\n`;

flush(callback) {
if (!this.active || this.lock || !this.buffer.length) {
if (callback) callback(new Error('Can\'t flush log buffer'));
if (this.lock) {
if (callback) this.once('unlocked', callback);
return;
}
if (this.buffer.length === 0) {
if (callback) callback();
return;
}
if (!this.active) {
if (callback)
callback(new Error('Cannot flush log buffer: logger is not opened'));
return;
}
this.lock = true;
const buffer = Buffer.concat(this.buffer);
this.buffer.length = 0;
this.stream.write(buffer, err => {
this.stream.write(buffer, () => {
this.lock = false;
if (callback) callback(err);
this.emit('unlocked');
if (callback) callback();
});

@@ -264,5 +285,4 @@ }

}
}
module.exports = args => new Logger(args);
{
"name": "metalog",
"version": "1.0.4",
"version": "1.0.5",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -23,3 +23,4 @@ "description": "Meta Logger for Metarhia",

"test": "eslint . && metatests test/",
"lint": "eslint ."
"lint": "eslint . && prettier -c \"**/*.js\" \"**/*.json\" \"**/*.md\" \".*rc\" \"**/*.yml\"",
"fmt": "prettier --write \"**/*.js\" \"**/*.json\" \"**/*.md\" \".*rc\" \"**/*.yml\""
},

@@ -35,4 +36,7 @@ "engines": {

"eslint": "^5.12.0",
"metatests": "^0.4.0"
"eslint-config-prettier": "^3.5.0",
"eslint-plugin-prettier": "^3.0.1",
"metatests": "^0.4.0",
"prettier": "1.16.x"
}
}

@@ -17,3 +17,3 @@ # Meta Logger for Metarhia

- Timur Shemsedinov (marcusaurelius) <timur.shemsedinov@gmail.com>
- See github for full [contributors list](https://github.com/metarhia/metalog/graphs/contributors)
- Timur Shemsedinov (marcusaurelius) <timur.shemsedinov@gmail.com>
- See github for full [contributors list](https://github.com/metarhia/metalog/graphs/contributors)

@@ -11,3 +11,3 @@ 'use strict';

writeBuffer: 64 * 1024,
keepDays: 5
keepDays: 5,
});

@@ -33,2 +33,1 @@

logger.close();

@@ -6,10 +6,11 @@ 'use strict';

const createLogger = () => metalog({
path: './log',
node: 'S1N1',
writeInterval: 3000,
writeBuffer: 64 * 1024,
keepDays: 5,
toStdout: []
}).bind('app1');
const createLogger = () =>
metalog({
path: './log',
node: 'S1N1',
writeInterval: 3000,
writeBuffer: 64 * 1024,
keepDays: 5,
toStdout: [],
}).bind('app1');

@@ -16,0 +17,0 @@ const logger1 = createLogger();

Sorry, the diff of this file is not supported yet

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