https://github.com/shieldfy/shieldfy-logger
Wrap the Winston logger / Elastic search plugin for fast logging usage
https://github.com/shieldfy/shieldfy-logger
Last synced: 6 months ago
JSON representation
Wrap the Winston logger / Elastic search plugin for fast logging usage
- Host: GitHub
- URL: https://github.com/shieldfy/shieldfy-logger
- Owner: shieldfy
- Created: 2019-12-17T13:36:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-07-07T15:02:44.000Z (over 3 years ago)
- Last Synced: 2024-11-06T03:51:14.816Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 43 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# shieldfy-logger
winston and winston-elasticsearh based logger client for log streaming
## Requirements
this package requires node >= 8.0.0
## Installing
Using npm:
```bash
$ npm install shieldfy-logger
```
Using yarn:
```bash
$ yarn add shieldfy-logger
```
## Example
```js
// import the package
const shieldfyLogger = require('shieldfy-logger');
// initialize the logger
const logger = shieldfyLogger({ service: 'test-service', host:'http://localhost:9200', env: 'development'})
// const logger = shieldfyLogger({ service: 'test-service' })
// start sending logs :)
logger.info('test info log', { staus: 'success' })
logger.error('test error log', { staus: 'error' })
```
**note:** if you want to attach data , pass it in the second parameter. If you pass it by the first parameter it will be strignified and mutated.
## Parameters
| parameter | required | defualt | description |
| --------- | -------- | ------------------------------ | ------------------- |
| service | true | _ | service name |
| host | false | process.env.ELASTICSEARCH_HOST | elastic search host |
| env | false | process.env.APP_ENV | the run environment |
## Contributions
Feel free to fork the repo and submit a PR :)
## License
[MIT](LICENSE)