npm install --save iog-browser
const Iog = require('iog-browser');
const logger = new Iog('my-module-name');
logger.write('my log info');
logger.write({
also: {
you: 'want, for example an object'
}
});
this produces
logger.write('my log info');
this in your console
[A-CONTEXT][LOG] my log info
Kind: global class
Iog instance
Param | Type | Default | Description |
---|---|---|---|
contextName | string | es. your-module-name |
|
[opts] | object | options |
|
[opts.path=] | string | log path |
|
[opts.pretty] | boolean | false | Pretty format |
[opts.enableDate] | boolean | false | Enable date |
[opts.separator] | string | "---" | log separator |
iog.pause() ⇒ Iog
Pause log writing
Kind: instance method of Iog
iog.resume() ⇒ Iog
Resume log writing
Kind: instance method of Iog
Write log
Kind: instance method of Iog
Param | Type | Default | Description |
---|---|---|---|
msg | string | object | message log, you can pass also an object with custom params, in this case remember that Error must be get in this way error.message |
|
[type] | string | "log" | any type that you want like: log, info, error, trace, warn also custom |
A wrapper of write that set type to "error"
Kind: instance method of Iog
Param | Type | Description |
---|---|---|
msg | string | object | message log, you can pass also an object with custom params, in this case remember that Error must be get in this way error.message |
A wrapper of write that set type to "warn"
Kind: instance method of Iog
Param | Type | Description |
---|---|---|
msg | string | object | message log, you can pass also an object with custom params, in this case remember that Error must be get in this way error.message |
A wrapper of write that set type to "info"
Kind: instance method of Iog
Param | Type | Description |
---|---|---|
msg | string | object | message log, you can pass also an object with custom params, in this case remember that Error must be get in this way error.message |
A wrapper of write that set type to "trace"
Kind: instance method of Iog
Param | Type | Description |
---|---|---|
msg | string | object | message log, you can pass also an object with custom params, in this case remember that Error must be get in this way error.message |
iog-browser is open-sourced software licensed under the MIT license