Awesome log and types for javascript and typescript!
npm install --save ptz-log
import log from 'ptz-log';
log('hi');
// Colors or breakLine are optional
// Default behavior: BreakLine after every arg and do not breakLine after color config obj
log({ ptzColorLog: 'red'}, 'welcome', { ptzColorLog: 'yellow', breakLine: true }, // welcome to
'to', { ptzColorLog: 'green' }, 'polutz!'); // polutz
How to use Ilog type as dependency injection, and provide your custom logs
import { Ilog, log } from 'ptz-log';
const myLog: Ilog = function (...args) {
console.log('From my custom logging:', ...args);
}
class Test {
log: Ilog;
constructor({ log: Ilog }) {
this.log = log;
}
testing() {
log('returning true!');
return true;
}
}
const test = new Test({ log: myLog });
test.testing();
npm install -g ts-node babel-cli
npm install
npm test