index.js
function log(type, label, data) {
	var typeLabel = type.charAt(0).toUpperCase() + type.slice(1);
	var color;

	if (typeLabel === 'Error') {
		typeLabel = chalk.red(typeLabel);
		color = 'red';
	} else if (typeLabel === 'Warn') {
		typeLabel = chalk.yellow(typeLabel);
		color = 'yellow';
	} else if (typeLabel === 'Info') {
		typeLabel = chalk.green(typeLabel);
		color = 'green';
	} else if (typeLabel === 'Log') {
		typeLabel = chalk.gray(typeLabel);
		color = 'gray';
	}

	// used to avoid logging "undefined" in the console
	if (useTypeLabels) {
		label = typeLabel + ': ' + chalk.cyan(label);
	} else {
		label = chalk[color](label);
	}
	if (data) {
		console[type](label, data);
	} else {
		console[type](label);
	}
}
function log(type, label, data) {
	var typeLabel = type.charAt(0).toUpperCase() + type.slice(1);
	var color;

	if (typeLabel === 'Error') {
		typeLabel = chalk.red(typeLabel);
		color = 'red';
	} else if (typeLabel === 'Warn') {
		typeLabel = chalk.yellow(typeLabel);
		color = 'yellow';
	} else if (typeLabel === 'Info') {
		typeLabel = chalk.green(typeLabel);
		color = 'green';
	} else if (typeLabel === 'Log') {
		typeLabel = chalk.gray(typeLabel);
		color = 'gray';
	}

	// used to avoid logging "undefined" in the console
	if (useTypeLabels) {
		label = typeLabel + ': ' + chalk.cyan(label);
	} else {
		label = chalk[color](label);
	}
	if (data) {
		console[type](label, data);
	} else {
		console[type](label);
	}
}
function log ( type , label , data ) { var typeLabel = type . charAt ( 0 ) . toUpperCase ( ) + type . slice ( 1 ) ; var color ; if ( typeLabel === 'Error' ) { typeLabel = chalk . red ( typeLabel ) ; color = 'red' ; } else if ( typeLabel === 'Warn' ) { typeLabel = chalk . yellow ( typeLabel ) ; color = 'yellow' ; } else if ( typeLabel === 'Info' ) { typeLabel = chalk . green ( typeLabel ) ; color = 'green' ; } else if ( typeLabel === 'Log' ) { typeLabel = chalk . gray ( typeLabel ) ; color = 'gray' ; } // used to avoid logging "undefined" in the console if ( useTypeLabels ) { label = typeLabel + ': ' + chalk . cyan ( label ) ; } else { label = chalk [ color ] ( label ) ; } if ( data ) { console [ type ] ( label , data ) ; } else { console [ type ] ( label ) ; } }
Beutifies the log data and logs!
@method log
@param  {string} type  The log type
@param  {string} label The log label
@param  {any} data  The data to display next to the label (optional)
Beutifies the log data and logs!