An open API service indexing awesome lists of open source software.

https://github.com/fabioricali/iog

Save your logs on disk, so simply.
https://github.com/fabioricali/iog

catch error log logger try-catch

Last synced: about 1 year ago
JSON representation

Save your logs on disk, so simply.

Awesome Lists containing this project

README

          

# iog
Save your logs on disk, so simply.




## Installation
```
npm install --save iog
```

## Example
```javascript
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
```javascript
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
```javascript

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

{{>main}}

## License
Iog is open-sourced software licensed under the MIT license

## Author
Fabio Ricali