ZIJ / console.log-wrapper

Log to the console in any browser with clarity

Home Page:http://patik.github.io/console.log-wrapper/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

All-in-one console.log wrapper

Just drop consolelog.js in your project and start passing data to log(). Whichever browser you're testing in, you'll see your data in the console — if the browser doesn't have a console, Firebug Lite will load. You can pass any variable type: strings, objects, arrays, functions, etc.

Demo: patik.github.io/console.log-wrapper

Usage

Install using npm: npm install consolelog or Bower: bower install consolelog

Or download and reference consolelog.js in your page.

Use log() to write to the console.

Detail Print

This is an optional plugin to provide help information about the data that is being logged, especially in IE and older browsers. Just include consolelog.detailprint.js along with consolelog.js.

Firebug, WebKit's Developer Tools, and Opera's Dragonfly print useful, interactive items to the console. For example:

console.log( "Here's a string",
             3.14,
             {"alpha": 5, "bravo": false},
             document.getElementById('charlie'),
             new Date()
           );

Results in:

Firebug running in Firefox

Some browsers that have a primitive console — ones that does not expand arrays, links DOM elements to the source code, prints objects as [object Object] rather than listing their properties, etc.

IE8 without Detail Print

Some cannot accept multiple arguments to a single console.log call. This includes IE 7/8/9/10, iOS 5 and older, and Opera 11 and older, among others.

Using the detailPrint companion plugin, special objects are presented in a more readable manner.

IE8 with Detail Print

Demo

patik.github.io/console.log-wrapper

Documentation

patik.com/blog/complete-cross-browser-console-log

About

Log to the console in any browser with clarity

http://patik.github.io/console.log-wrapper/

License:Other


Languages

Language:JavaScript 100.0%