New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gracenode

Package Overview
Dependencies
Maintainers
1
Versions
381
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gracenode - npm Package Compare versions

Comparing version 0.3.6 to 0.3.7

34

CHANGELOG.md
# Change Log
## Version 0.3.7
### Added
None
### Changed
#### improved log module buffering
Log module's auto buffer flushing is improved.
### Depricated
None
### Removed
None
# Future backward compatibility break
We will be removing the current built-in module system.
The current built-in modules will be all externalized and required to be included in your application's package.json.
As of version 0.3.7, we still have the current module system and the new driver system.
Planned removal of the built-in modules is version 1.0.0
***
## Version 0.3.6

@@ -11,4 +43,2 @@

gracenode's core driver has improved error checks.
#### log module buffering

@@ -15,0 +45,0 @@

5

modules/log/lib/file.js

@@ -38,5 +38,6 @@ var fs = require('fs');

module.exports.log = function (levelName, msg) {
// cb is optional for auto buffer flushing
module.exports.log = function (levelName, msg, cb) {
var stream = getWriteStream(levelName);
stream.write(msg.message + '\n');
stream.write(msg.message + '\n', cb);
};

@@ -43,0 +44,0 @@

@@ -19,3 +19,4 @@ var dgram = require('dgram');

module.exports.log = function (levelName, msg) {
// cb is optional for auto buffer flushing
module.exports.log = function (levelName, msg, cb) {
// check config

@@ -45,3 +46,6 @@ if (!config || !config.port || !config.host) {

client.close();
if (cb) {
cb();
}
});
};

@@ -0,1 +1,2 @@

var async = require('async');
var gracenode;

@@ -36,30 +37,13 @@ var ip = require('./lib/ip');

gracenode._addLogCleaner('exit', function (done) {
that._autoFlush();
done();
that._autoFlush(done);
});
}
// auto flush buffered log data at x miliseconds
// Node.js timer implementation should be effecient for handling lots of timers
// https://github.com/joyent/node/blob/master/deps/uv/src/unix/timer.c #120
setTimeout(function () {
that._autoFlush();
that._autoFlush(function () { /* we do not need to keep track of this */ });
}, autoFlushInterval);
}
Logger.prototype._autoFlush = function () {
var flushed = buff.flushAll();
for (var level in flushed) {
// if there is no config -> we output nothing
if (!this.config || !this.config.level) {
continue;
}
// check enabled or not
if (!this.config.level[level]) {
// not enabled
continue;
}
if (flushed[level]) {
this._outputLog(level, flushed[level]);
}
}
};
Logger.prototype.verbose = function () {

@@ -128,1 +112,39 @@ this._handleLog('verbose', arguments);

};
Logger.prototype._autoFlush = function (cb) {
var that = this;
var flushed = buff.flushAll();
var list = Object.keys(flushed);
async.each(list, function (level, callback) {
// if there is no config -> we output nothing
if (!that.config || !that.config.level) {
return callback();
}
// check enabled or not
if (!that.config.level[level]) {
// not enabled
return callback();
}
if (!flushed[level]) {
return callback();
}
var data = flushed[level];
var fileLog = function (next) {
if (that.config.file) {
return file.log(level, data, next);
}
next();
};
var remoteLog = function (next) {
if (that.config.remote) {
return remote.log(level, data, next);
}
next();
};
if (that.config.console) {
console.log(data.message);
}
events.emit('output', address, that.name, level, data);
async.series([fileLog, remoteLog], callback);
}, cb);
};
{
"name": "gracenode",
"description": "Framework for node.js application with extendable module management system for fast and clean development.",
"version": "0.3.6",
"version": "0.3.7",
"author": "Nobuyori Takahashi <voltrue2@yahoo.com>",

@@ -6,0 +6,0 @@ "repository": {

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