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

mvcjs

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mvcjs - npm Package Compare versions

Comparing version 0.1.0-beta-7 to 0.1.0-beta-8

43

framework/core/logger.js

@@ -30,2 +30,3 @@ "use strict";

config: Type.OBJECT,
length: Type.NUMBER,
hooks: Type.ARRAY

@@ -36,4 +37,4 @@ },

var file;
this.stream = null;
this.server = null;
this.length = 0;
this.stream = this.server = null;
this.hooks = [];

@@ -45,2 +46,3 @@ this.config = core.extend({

console: false,
readLength: 20000,
port: 9001,

@@ -55,8 +57,36 @@ file: "server.log",

if (this.config.publish) {
this.server = http.createServer();
this.server.on('request', function (request, response) {
var read = fs.readFileSync(file);
response.writeHead(200, {'Content-type': 'text/plain', 'Content-Length': read.length});
response.end(read);
});
var len = this.length,
start = len - this.config.readLength,
blen = 0,
buffer,
blenMessage;
if (start < 0) {
start = 0;
blen = 1000;
} else {
blen = len - start;
}
blenMessage = 'LAST '+ blen + ' BYTES:\n\n';
buffer = new Buffer(blen + blenMessage.length, 'utf8');
fs.open(file, 'r', 755, function(status, fd) {
fs.read(fd, buffer, 0, blen, start, function(err) {
if (err) {
var errorMessage = 'Error reading logger buffer';
response.writeHead(200, {'Content-type': 'text/plain', 'Content-Length': errorMessage.length});
response.end(errorMessage);
} else {
response.writeHead(200, {'Content-type': 'text/plain', 'Content-Length': buffer.length});
response.write(blenMessage);
response.end(buffer);
}
});
});
}.bind(this));
this.server.listen(this.config.port);

@@ -146,2 +176,3 @@ this.print('Publishing log write stream on port: ' + this.config.port);

try {
this.length += logs.length;
this.stream.write(logs);

@@ -148,0 +179,0 @@ } catch (e) {

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Powerful lightweight mvc framework for nodejs",
"version": "0.1.0-beta-7",
"version": "0.1.0-beta-8",
"dependencies" : {

@@ -8,0 +8,0 @@ "mongoose": "3.8.x",

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