Giter VIP home page Giter VIP logo

console.js's Introduction

Console.js

A sane way to interface with your console and use the latest features.

console

support

Selenium Test Status

modern usage (Chrome / Firefox / IE >= 9)

modern mode is great if you're fine with overriding console methods, and don't mind additional methods on your String.prototype

// Step 1: override console methods and enable String.prototype styles
Console.attach();
Console.styles.attach();

// Step 2: register your styles
Console.styles.register({
	bold: 'font-weight:bold',
	underline: 'text-decoration:underline',

	red: 'color:#de4f2a',
	blue: 'color:#1795de',
	green: 'color:green',
	grey: 'color:grey',

	code: 'background: rgb(255, 255, 219); padding: 1px 5px; border: 1px solid rgba(0, 0, 0, 0.1); line-height: 18px; text-decoration:underline;'
});

// Step 3: profit!
console.log('hello'.red.bold);

compatibility usage

compatibility mode is useful if you want your logs to work in IE < 9, or you don't want be invasive on the console or String.prototype

// Step 1: because we aren't using String.prototype, we make our lives a little easier by creating a shortcut
window.F = Console.styles.format;

// Step 2: register your styles
Console.styles.register({
	bold: 'font-weight:bold',
	underline: 'text-decoration:underline',

	red: 'color:#de4f2a',
	blue: 'color:#1795de',
	green: 'color:green',
	grey: 'color:grey',

	code: 'background: rgb(255, 255, 219); padding: 1px 5px; border: 1px solid rgba(0, 0, 0, 0.1); line-height: 18px; text-decoration:underline;'
});

// Step 3: profit!
Console.log(F('hello', 'red,bold'));

console.js's People

Contributors

icodeforlove avatar

Watchers

Gijs Nijholt avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.