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

Consider making logging more granular #333

Closed
MeltyBot opened this issue Feb 24, 2022 · 2 comments · Fixed by #1854
Closed

Consider making logging more granular #333

MeltyBot opened this issue Feb 24, 2022 · 2 comments · Fixed by #1854

Comments

@MeltyBot
Copy link
Contributor

MeltyBot commented Feb 24, 2022

Migrated from GitLab: https://gitlab.com/meltano/sdk/-/issues/335

Originally created by @edgarrmondragon on 2022-02-24 03:15:15


Summary

Leverage Python's dot-separated logger hierarchy to give developers more control over logging behavior and make it more granular:

  • Behavior: handler, format, level
  • Source: tap, stream, SDK.

Proposed benefits

Developers can make output more or less verbose for certain streams, etc.

Proposal details

Screen_Shot_2022-02-23_at_21.06.12

>>> import logging
>>> formatter = logging.Formatter("{asctime} {levelname} {message}", style="{")
>>> handler = logging.StreamHandler()
>>> handler.setFormatter(formatter)
>>> tap_logger = logging.getLogger("tap-example")
>>> tap_logger.addHandler(handler)
>>> tap_logger.setLevel(logging.INFO)  # Display INFO and up
>>> stream_logger = logging.getLogger("tap-example.my_stream")
>>> stream_logger.setLevel(logging.WARNING)  # Display WARNING and up
>>> tap_logger.debug("Info from tap")
>>> tap_logger.info("Info from tap")
2022-02-23 21:10:34,165 INFO Info from tap
>>> stream_logger.info("Info from stream")  # No output at this level!
>>> stream_logger.warning("Warning from stream")
2022-02-23 21:10:34,175 WARNING Warning from stream

Best reasons not to build

We may not want developers to make their packages to quiet so end-users have useful debugging information by default.

@MeltyBot
Copy link
Contributor Author

@stale
Copy link

stale bot commented Jul 18, 2023

This has been marked as stale because it is unassigned, and has not had recent activity. It will be closed after 21 days if no further activity occurs. If this should never go stale, please add the evergreen label, or request that it be added.

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