Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logrus Entry vs Logger #23

Open
tiny-dancer opened this issue Sep 6, 2019 · 0 comments
Open

Logrus Entry vs Logger #23

tiny-dancer opened this issue Sep 6, 2019 · 0 comments

Comments

@tiny-dancer
Copy link

tiny-dancer commented Sep 6, 2019

To support logging already defined fields using logrus, is there any concern with switching to Entry rather than Logger?

From logrus docs:

These objects can be reused and passed around as much as you wish to avoid field duplication.

Add README

Often it's helpful to have fields always attached to log statements in an application or parts of one. For example, you may want to always log the request_id and user_ip in the context of a request. Instead of writing log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip}) on every line, you can create a logrus.Entry to pass around instead:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant