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

Implement (optional) structured logging #10

Open
adamcharnock opened this issue Nov 14, 2019 · 0 comments
Open

Implement (optional) structured logging #10

adamcharnock opened this issue Nov 14, 2019 · 0 comments
Milestone

Comments

@adamcharnock
Copy link
Owner

adamcharnock commented Nov 14, 2019

I enquired with @hynek regarding how to implement this within a library. His abridged response:


There are basically two problems to be solved:

  1. How to configure? I think the user should configure structlog themselves and should be required to tell your lib explicitly that it wants to use structlog.
  2. How to log? Since structlog with its k/v support is a superset of logging and you want k/v logging this is not trivial. I think the best way would be to write a very thin shim that allows for log.info("event", x=y, a=b) and if structlog is not used, it’s will either format the k/v or transform it into logging-specific context information by passing it into logging.info("event", extra={"x": y, "a": b})?

Point 2 is mostly just a suggestion/request for comments, since nobody has done that publicly so far…


As an aside, the currently logging system does need a drastic overhaul. It is a bit rickety and it's saving grace is simply that it hasn't needed any modification in a long time. (See #16)

Any new logging system should avoid string interpolation, thereby allowing us to re-enable the logging-fstring-interpolation / logging-format-interpolation pylint checks

@adamcharnock adamcharnock mentioned this issue Nov 14, 2019
98 tasks
@adamcharnock adamcharnock added this to the 0.11.0 milestone Jan 11, 2020
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