conditional-console

An easy way of using console.log depending on conditions.


Keywords
Console, Conditional, Debug, Developer
License
MIT
Install
npm install conditional-console@1.0.1

Documentation

ConditionalConsole

This allows for chained conditions, before outputting to console.log(). And (the important part) it supports showing the correct line, from where the log is called.

Installation

npm install conditional-console

Or include the ConditionalConsole.min.js file in..

<script src="ConditionalConsole.min.js"></script>

Usage

This simple example gives the general idea.

cci.check(1 === 1).log('This is logged');
cci.check(1 !== 1).check(1 === 2).log('And this is not')

There's also an build in reporting system.

cci.setReporting('all -verbose')
cci.type('verbose').log('Not shown.');
cci.type('error').log('Shown.');
cci.type('error').check(false).log('Not shown, because of the check.');