๐Ÿ“ฆ shieldfy / shieldfy-logger

Wrap the Winston logger / Elastic search plugin for fast logging usage

โ˜… 3 stars โ‘‚ 0 forks ๐Ÿ‘ 3 watching
๐Ÿ“ฅ Clone https://github.com/shieldfy/shieldfy-logger.git
HTTPS git clone https://github.com/shieldfy/shieldfy-logger.git
SSH git clone git@github.com:shieldfy/shieldfy-logger.git
CLI gh repo clone shieldfy/shieldfy-logger
Eslam Salem Eslam Salem Merge pull request #1 from shieldfy/dependabot/npm_and_yarn/lodash-4.17.19 2dbe612 5 years ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ test
๐Ÿ“„ .gitignore
๐Ÿ“„ index.js
๐Ÿ“„ package-lock.json
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ README.md

shieldfy-logger

winston and winston-elasticsearh based logger client for log streaming

Requirements

this package requires node >= 8.0.0

Installing

Using npm:

$ npm install shieldfy-logger

Using yarn:

$ yarn add shieldfy-logger

Example

// 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

parameterrequireddefualtdescription
servicetrueservice name
hostfalseprocess.env.ELASTICSEARCHHOSTelastic search host
envfalseprocess.env.APP_ENVthe run environment

Contributions

Feel free to fork the repo and submit a PR :)

License

MIT