npm.io
1.2.1 • Published 8 years ago

ptz-log

Licence
ISC
Version
1.2.1
Deps
1
Vulns
0
Weekly
0
Stars
3

ptz-log

Build Status NPM codecov.io Dependency Status bitHound Score MIT license

Awesome log and types for javascript and typescript!

Translations

pt-br en-us

Use

Install
    npm install --save ptz-log
How to use
    import log from 'ptz-log';

    log('hi');
    // Colors are optional
    log({ ptzColorLog: 'red' }, 'welcome',
        { ptzColorLog: 'yellow' }, 'to',
        { ptzColorLog: 'green' }, '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();

Contribute

NPM Global packages
    npm install -g ts-node babel-cli
Setup
    npm install   
Test
    npm test