Some jsstyle cleaning.
This commit is contained in:
parent
ae219885b7
commit
d89444baed
5 changed files with 34 additions and 22 deletions
17
Makefile
17
Makefile
|
@ -4,6 +4,12 @@
|
|||
TAP := ./node_modules/.bin/tap
|
||||
|
||||
|
||||
#---- Files
|
||||
|
||||
JSSTYLE_FILES := $(shell find lib test tools -name *.js)
|
||||
|
||||
|
||||
|
||||
#---- Targets
|
||||
|
||||
all:
|
||||
|
@ -23,3 +29,14 @@ cutarelease: versioncheck
|
|||
test: $(TAP)
|
||||
TAP=1 $(TAP) test/*.test.js
|
||||
|
||||
.PHONY: check-jsstyle
|
||||
check-jsstyle: $(JSSTYLE_FILES)
|
||||
./tools/jsstyle -o indent=2,doxygen,unparenthesized-return=0,blank-after-start-comment=0 $(JSSTYLE_FILES)
|
||||
|
||||
.PHONY: check
|
||||
check: check-jsstyle
|
||||
@echo "Check ok."
|
||||
|
||||
.PHONY: prepush
|
||||
prepush: check test
|
||||
@echo "Okay to push."
|
||||
|
|
|
@ -34,7 +34,7 @@ test('ensure Logger creation options', function (t) {
|
|||
{name: 'TypeError', message: 'invalid options.streams: must be an array'},
|
||||
'"streams" must be an array');
|
||||
|
||||
options = {name: 'foo', serializers: "a string"};
|
||||
options = {name: 'foo', serializers: 'a string'};
|
||||
t.throws(function () { new Logger(options); },
|
||||
{name: 'TypeError', message: 'invalid options.serializers: must be an object'},
|
||||
'"serializers" cannot be a string');
|
||||
|
@ -87,5 +87,3 @@ test('ensure Logger child() options', function (t) {
|
|||
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ var ben = require('ben'); // npm install ben
|
|||
var Logger = require('../lib/bunyan');
|
||||
|
||||
var log = new Logger({
|
||||
name: "svc",
|
||||
name: 'svc',
|
||||
streams: [
|
||||
{
|
||||
path: __dirname + "/timechild.log"
|
||||
path: __dirname + '/timechild.log'
|
||||
},
|
||||
{
|
||||
stream: process.stdout
|
||||
|
@ -31,7 +31,7 @@ var log = new Logger({
|
|||
}
|
||||
});
|
||||
|
||||
console.log("Time `log.child`:");
|
||||
console.log('Time `log.child`:');
|
||||
|
||||
var ms = ben(1e5, function () {
|
||||
var child = log.child();
|
||||
|
@ -62,12 +62,11 @@ console.log(' - adding serializer and one field: %dms per iteration', ms);
|
|||
var ms = ben(1e5, function () {
|
||||
var child = log.child({
|
||||
a: 1,
|
||||
streams: [{
|
||||
stream: process.stderr
|
||||
}]
|
||||
streams: [ {stream: process.stderr} ]
|
||||
});
|
||||
});
|
||||
console.log(' - adding a (stderr) stream and one field: %dms per iteration', ms);
|
||||
console.log(' - adding a (stderr) stream and one field: %dms per iteration',
|
||||
ms);
|
||||
|
||||
var ms = ben(1e6, function () {
|
||||
var child = log.child({}, true);
|
||||
|
@ -83,4 +82,3 @@ var ms = ben(1e6, function () {
|
|||
var child = log.child({a:1, b:2}, true);
|
||||
});
|
||||
console.log(' - [fast] adding two fields: %dms per iteration', ms);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Time logging with/without a try/catch-guard on the JSON.stringify.
|
||||
*/
|
||||
|
||||
console.log("Time try/catch-guard on JSON.stringify:");
|
||||
console.log('Time try/catch-guard on JSON.stringify:');
|
||||
|
||||
var ben = require('ben'); // npm install ben
|
||||
var Logger = require('../lib/bunyan');
|
||||
|
@ -11,19 +11,18 @@ var Logger = require('../lib/bunyan');
|
|||
var records = [];
|
||||
function Collector() {
|
||||
}
|
||||
Collector.prototype.write = function(s) {
|
||||
Collector.prototype.write = function (s) {
|
||||
//records.push(s);
|
||||
}
|
||||
var collector = new Collector();
|
||||
|
||||
var log = new Logger({
|
||||
name: "timeguard",
|
||||
name: 'timeguard',
|
||||
src: true,
|
||||
stream: collector
|
||||
});
|
||||
|
||||
var ms = ben(1e5, function () {
|
||||
log.info("hi");
|
||||
log.info('hi');
|
||||
});
|
||||
console.log(' - log.info: %dms per iteration', ms);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Time 'src' fields (getting log call source info). This is expensive.
|
||||
*/
|
||||
|
||||
console.log("Time adding 'src' field with call source info:");
|
||||
console.log('Time adding "src" field with call source info:');
|
||||
|
||||
var ben = require('ben'); // npm install ben
|
||||
var Logger = require('../lib/bunyan');
|
||||
|
@ -11,27 +11,27 @@ var Logger = require('../lib/bunyan');
|
|||
var records = [];
|
||||
function Collector() {
|
||||
}
|
||||
Collector.prototype.write = function(s) {
|
||||
Collector.prototype.write = function (s) {
|
||||
//records.push(s);
|
||||
}
|
||||
var collector = new Collector();
|
||||
|
||||
var logwith = new Logger({
|
||||
name: "with-src",
|
||||
name: 'with-src',
|
||||
src: true,
|
||||
stream: collector
|
||||
});
|
||||
|
||||
var ms = ben(1e5, function () {
|
||||
logwith.info("hi");
|
||||
logwith.info('hi');
|
||||
});
|
||||
console.log(' - log.info with src: %dms per iteration', ms);
|
||||
|
||||
var logwithout = new Logger({
|
||||
name: "without-src",
|
||||
name: 'without-src',
|
||||
stream: collector
|
||||
});
|
||||
var ms = ben(1e5, function () {
|
||||
logwithout.info("hi");
|
||||
logwithout.info('hi');
|
||||
});
|
||||
console.log(' - log.info without src: %dms per iteration', ms);
|
||||
|
|
Loading…
Reference in a new issue