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

restify

Package Overview
Dependencies
Maintainers
0
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restify - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

docs/log.md

35

lib/log.js

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

// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
/* Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
*
* A (very) minimal log4j-like knockoff.
*
* Usage:
* var log = require('restify').log
* log.debug("some debug info: %o", myobj) // sprintf string interpolation
* log.warn("I can't let you do that, %s.", dave)
*
* Output goes to stderr. Looks like this:
* 2011-03-25 20:28:21Z DEBUG: some debug info: {'foo': 'bar'}
* 2011-03-25 20:30:21Z WARN: I can't let you do that, Dave.
*
* Log levels are:
* trace // access via `log.Level.Trace`
* debug
* info // the default
* warn
* error
* fatal
* Set the log level via:
* log.level(log.Level.Warn)
*
* The `log.debug()`, `log.info()`, et al functions double as the log4j
* `isEnableFor`, `isDebugEnabled` functions when called without arguments.
* So you can skip expensive computation that is only needed if at a
* given log level:
* if (log.debug()) {
* // some expensive calculations to get
* some_debug_data = ...
* log.debug("debug data is: %o", some_debug_data)
* }
*/
var assert = require('assert');

@@ -3,0 +36,0 @@ var util = require('util');

45

lib/restify.js

@@ -174,3 +174,3 @@ // Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.

}
} catch(e) {
} catch (e) {
return response.sendError(newError({

@@ -302,3 +302,3 @@ httpCode: HttpCodes.BadRequest,

response._config = server._config;
response.startTime = new Date().getTime();
request.startTime = response.startTime = new Date().getTime();
response._allowedMethods = [];

@@ -390,2 +390,15 @@

server._config.apiVersion = undefined;
function _errorHandler(e) {
process.on('uncaughtException', function(e) {
log.warn('uncaughtException: ' + (e.stack ? e.stack : e));
if (_response) {
_response.writeHead(HttpCodes.InternalError);
_response.end();
_response = null;
}
});
};
if (options) {

@@ -398,12 +411,4 @@ if (options.apiVersion) {

}
if (options.installExceptionHandler) {
process.on('uncaughtException', function(e) {
log.warn('uncaughtException: ' + (e.stack ? e.stack : e));
if (_response) {
_response.writeHead(HttpCodes.InternalError);
_response.end();
_response = null;
}
});
if (options.exceptionHandler) {
process.on('uncaughtException', options.exceptionHandler);
}

@@ -416,2 +421,5 @@ if (options.maxRequestSize) {

}
if (options.accept) {
server._config.acceptable = options.accept;
}
if (options.clockSkew) {

@@ -435,2 +443,15 @@ server._config.clockSkew = options.clockSkew * 1000;

}
if (!options &&
!options.exceptionHandler) {
process.on('uncaughtException', function(e) {
log.warn('uncaughtException: ' + (e.stack ? e.stack : e));
if (_response) {
_response.writeHead(HttpCodes.InternalError);
_response.end();
_response = null;
}
});
}
server._config._acceptable = {};

@@ -437,0 +458,0 @@ for (var i = 0; i < server._config.acceptable.length; i++) {

{
"name": "restify",
"description": "REST framework specifically meant for web service APIs",
"version": "0.1.6",
"version": "0.1.7",
"repository": {

@@ -15,4 +15,8 @@ "type": "git",

"scripts": {
"test": "nodeunit tst"
"test": "./node_modules/nodeunit/bin/nodeunit tst"
},
"man": {
"name": "restify",
"man": ["./docs/restify.3", "./docs/request.3", "./docs/response.3", "./docs/log.3"]
},
"devDependencies": {

@@ -19,0 +23,0 @@ "httpu": ">=0.0.1",

Sorry, the diff of this file is not supported yet

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