logspect
A small utility for console.logging objects with Node's util.inspect. Defaults to plain console.log in browsers.
Importing logspect
First, install logspect via NPM or Yarn:
# NPM npm install --save logspect # Or Yarn yarn add logspect
logspect can be imported via ES6 default import syntax, or via Node's require:
// ES6 default import; // Node requireconst inspect = default;
Usage
Just like console.log
, you can pass as many arguments to logspect as you need:
const obj = hello: "world" foo: "bar"; ;
Changing the timezones
Every inspect call is prefixed with a timestamp, which by default is set to the "America/Chicago"
timezone and the "en-US"
locale. You can change those defaults by modifying the lib's exported defaults
object:
// ES6 ; // Nodeconst inspect = default;const defaults = defaults; defaultstimeZone = "UTC";