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.
- Host: GitHub
- URL: https://github.com/fabioricali/iog
- Owner: fabioricali
- Created: 2017-09-22T16:24:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-04T16:43:48.000Z (almost 6 years ago)
- Last Synced: 2025-03-07T18:50:39.232Z (over 1 year ago)
- Topics: catch, error, log, logger, try-catch
- Language: JavaScript
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.hbs
- Changelog: CHANGELOG.md
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