node-diagnostics
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -12,2 +12,3 @@ module.exports = function () { | ||
_prefix = typeof(prefix) === 'string' ? [prefix] : prefix; | ||
return createObject(); | ||
} | ||
@@ -36,3 +37,3 @@ | ||
} | ||
return update(); | ||
return createObject(); | ||
} | ||
@@ -69,3 +70,3 @@ | ||
function update() { | ||
function createObject() { | ||
return { | ||
@@ -87,6 +88,3 @@ "setLevel" : setLevel, | ||
return function (prefix) { | ||
setPrefix(prefix); | ||
return update(); | ||
}; | ||
return createObject(); | ||
}(); |
@@ -5,3 +5,3 @@ { | ||
"description" : "Logging and Timer to perform some basic profiling and diagnostics", | ||
"version" : "0.0.2", | ||
"version" : "0.0.3", | ||
"repository" : { | ||
@@ -8,0 +8,0 @@ "type" : "git", |
@@ -18,4 +18,4 @@ # Diagnostic logging and basic profiling using Timers | ||
# Include this as a module in your own project | ||
// All diagnostics logs will be prefixed with 'MyModuleName' | ||
var diag = require('node-diagnostics')('MyModuleName'); | ||
// All diagnostics logs will be prefixed with 'MyModuleName|42|' | ||
var diag = require('node-diagnostics').setPrefix(['MyModuleName',42]).setLevel(3); // info = 3 | ||
@@ -31,13 +31,13 @@ // Start a timer to display the elapsed time of this section of code. | ||
diag.log(diag.finest, 'FINEST|Will not be shown, but the string concatenation' | ||
diag.log(diag.finest, 'Will not be shown, but the string concatenation' | ||
+ ' will still be done and the method called, it is' | ||
+ ' slower than the next invocation.'); | ||
if (diag.level >= diag.finest) diag.log(diag.finest, 'FINEST|Will not be shown' | ||
if (diag.level >= diag.finest) diag.log(diag.finest, 'Will not be shown' | ||
+ ' but no method invocation and no string concatenation.' | ||
+ ' this is the prefered way'); | ||
if (diag.level >= diag.info) diag.log(diag.info, 'INFO|Will be shown!'); | ||
diag.log(diag.info, 'INFO|Will be shown!'); | ||
if (diag.level >= diag.info) diag.log(diag.info, 'Will be shown!'); | ||
diag.log(diag.info, 'Will be shown!'); | ||
diag.log(diag.info, 'test ran in ' + timer.stop().format()); |
@@ -1,2 +0,2 @@ | ||
var diag = require('../lib/diagnostics')(['test', 'prefix1', 'prefix2']).setLevel(1), | ||
var diag = require('../lib/diagnostics').setPrefix(['test', 'prefix1', 'prefix2']).setLevel(1), | ||
timer = diag.startTimer(); | ||
@@ -3,0 +3,0 @@ |
20241
167