log

Github Build Codacy Badge Codebeat Badge CodeFactor Badge DeepScan grade Analytics

Log

Dynamic console logging - log using the optimal console method. Provides method overwriting, beforeLog and afterLog hooks.

Visitor stats

GitHub stars GitHub forks GitHub watchers GitHub followers

Code stats

GitHub code size in bytes GitHub repo size GitHub language count GitHub top language GitHub last commit

Usage

// String
log('string');

// number
log(1);

// array
log(['test', '1', { object: 'prop' }, ['array']]);

// function
log(() => {
	const a = 1;
	const b = 2;

	return a + b;
});

// object
log({
	prop1: 'value1',
	prop2: {
		nestedProp1: 'nestedValue1',
		nestedProp2: 'nestedValue2',
		nestedProp3: 'nestedValue3',
		nestedProp4: 'nestedValue4'
	},
	prop3: 'value3',
	prop4: 'value4'
});

// null
log(null);

// undefined
log(undefined);
log(void 0);

// boolean
log(true);

// RegExp
log(/^[a-z]{3,}$/);

// Date
log(new Date());
log(new Date().getTime());

// Symbol
log(Symbol('foo'));

// Constructor
log(function () {});
log(class A {});
log(Array);
log(Function);
log(new Function());

// Map
const map = new Map();

map.set('key1', 'value1');
map.set('key2', 'value2');

log(map);

// set
const set = new Set();

set.add('value1');
set.add('value2');

log(set);

LICENSE

MIT


Connect with me:

                     

Support and sponsor my work:

  • Hire me onBraintrust
  • Hire me onToptal

Go back

Send me your message