1.6.0 • Published 4 years ago

iog v1.6.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

iog

Save your logs on disk, so simply.

Installation

npm install --save iog

Example

const Iog = require('iog');

const logger = new Iog('my-module-name', {
    onLog(body, type) {
        console.log(body, type)
    }
});

logger.write('my log info');
logger.write({
    also: {
        you: 'want, for example an object'
    }
});

Log format

this produces

logger.write('my log info');

this

CONTEXT: my-module-name
DATE: 2018-03-03 20:14:12:367
TYPE: log
BODY:

my log info

---------------------------------------------------------------------------------------

this produces

let obj = {
    error: "undefine is not defined",
    other: {
        meta: "a meta"
    }
};

logger.write(obj);

this

CONTEXT: my-module-name
DATE: 2018-03-03 20:14:12:367
TYPE: log
BODY:

{
    "error": "undefine is not defined",
    "other": {
        "meta": "a meta"
    }
}

---------------------------------------------------------------------------------------

API

Iog

Kind: global class

new Iog(contextName, opts)

Iog instance

iog.pause() ⇒ Iog

Pause log writing

Kind: instance method of Iog

iog.resume() ⇒ Iog

Resume log writing

Kind: instance method of Iog

iog.write(msg, type, show)

Write log

Kind: instance method of Iog

iog.error(msg)

A wrapper of write that set type to "error"

Kind: instance method of Iog

iog.warn(msg)

A wrapper of write that set type to "warn"

Kind: instance method of Iog

iog.info(msg)

A wrapper of write that set type to "info"

Kind: instance method of Iog

iog.trace(msg)

A wrapper of write that set type to "trace"

Kind: instance method of Iog

License

Iog is open-sourced software licensed under the MIT license

Author

Fabio Ricali

1.6.0

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago