Skip to content

Add Global context fields when creating ecs_logging.StdlibFormatter #57

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

Closed
rdifrango opened this issue Sep 1, 2021 · 6 comments · Fixed by #65
Closed

Add Global context fields when creating ecs_logging.StdlibFormatter #57

rdifrango opened this issue Sep 1, 2021 · 6 comments · Fixed by #65

Comments

@rdifrango
Copy link
Contributor

I know that based upon the work associated with #7 that context fields can be added to a given logging record, but what I would like to set is a default group that are populated on all log records and then any that are added via the extras on a given record they are added.

So I'd like to be able to do something like:

handler.setFormatter(ecs_logging.StdlibFormatter(extra={"environment": "dev"}))

Related discussion on the nodejs logger here.

@basepi
Copy link
Contributor

basepi commented Sep 2, 2021

Seems very reasonable. Thanks!

rdifrango added a commit to rdifrango/ecs-logging-python that referenced this issue Oct 7, 2021
basepi added a commit that referenced this issue Oct 27, 2021
* Resolves #57

See: #57

* Update _stdlib.py

Updated the type hints.

* Fix lint (mypy and line length)

* Update _stdlib.py

* Update _stdlib.py

Co-authored-by: Difrango, Ronald <ronald.difrango@fmr.com>
Co-authored-by: Colton Myers <colton.myers@gmail.com>
@alexsanderp
Copy link

News?

@rdifrango
Copy link
Contributor Author

@alexsanderp my PR was merged but not sure there's been a release

#65

@alexsanderp
Copy link

@rdifrango Merged into main, but the latest version doesn't have the changes :(

@basepi
Copy link
Contributor

basepi commented May 16, 2022

Ah, yeah, we need to do a release here. Thanks for the reminder.

@basepi
Copy link
Contributor

basepi commented May 18, 2022

2.0.0 is now released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants