simple-console0.1.1 • Public • Published
Provides a simple, but useful cross-browser-compatible
- Proxies to native functionality wherever possible.
- Buildable from straight CommonJS source.
- Available as minified distributions as well.
Install via npm:
$ npm install simple-console
$ bower install simple-console
SimpleConsole class into your code (via AMD, CommonJS, etc) and
use as a drop-in replacement for
console.OPERATION. Creating a new object
does not effect the existing
var SimpleConsole = ;var con = ;con;
In your HTML:
<!-- Option One: Minified --><!-- Option Two: Raw source -->
In your JS:
var con = ;con;
There are some cases where you will want to conditionally silence the logger.
You can do this by passing setting the
var con = noop: true ;con; // => Should _not_ output anything.
This is usually useful in a case where you build different capabilities based on some external information, for example, React-style, this could be something like:
var con =noop: processenvNODE_ENV === "production";con; // => Should _not_ output anything in `production`.
If you are looking to polyfill
console, then you can:
patch: true ;
This will mutate the
window.console object in ways that are not easily
undone, so consider this a "one way" patch. Moreover, if
does not exist, it will create the object.
You can even go further and patch and noop the logger with:
patch: true noop: true ;
which ensures that nothing logs anything.
Note: In addition to filling/patching missing behavior, the polyfill will
replace behavior that already exists and works. This is presently due to
complexities likely normalizing and ensuring things like
.call work on all log methods.
Run checks, then development server:
$ gulp check $ gulp dev
$ node examples/demo.js
- Bump versions in
npm run-script everything
Similar projects that can help with
Copyright 2015 Formidable Labs, Inc. Released under the MIT License,