-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from jplatte/patch-1
Use util.inspect with depth: null for traceAny on node.js
- Loading branch information
Showing
1 changed file
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
/* global exports, console */ | ||
/* global exports, console, require */ | ||
"use strict"; | ||
|
||
// module Debug.Trace | ||
|
||
exports.traceAny = function (x) { | ||
return function (k) { | ||
console.log(x); | ||
// node only recurses two levels into an object before printing | ||
// "[object]" for further objects when using console.log() | ||
if (require !== undefined) { | ||
var util = require("util"); | ||
console.log(util.inspect(x, { depth: null, colors: true })); | ||
} else { | ||
console.log(x); | ||
} | ||
|
||
return k({}); | ||
}; | ||
}; |