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

set up logging #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

set up logging #119

wants to merge 1 commit into from

Conversation

spolisar
Copy link

@spolisar spolisar commented Nov 14, 2024

Pull Request Template

TL;DR

  • Set up logging for streamlitanalytics2 properly with getLogger()
  • Used urllib3 as a reference for how logging should be set up in a library

Problem Solved

  1. When using streamlitanalytics2 and another library that has logging, info messages were being printed to the console when logging was not configured to do that.

Changes Made(Optional)

List the main changes in bullet points.

  • get a logger for the library and give it a null handler

Manual Testing

  • You have manually tested all changes to ensure they work as intended. Replace the [ ] with a [X] if True.

How was this tested?
Describe the tests that you ran to verify your changes.

  • Tested by running a streamlit app using the fork and a library with test logging INFO messages

Additional Notes

  • I used urllib3 and python's documentation as a reference for how logging should be configured in a library
  • If someone wants to access the logs in streamlit-analytics2 in an application using it they'd do something like this
import streamlit_analytics2
import logging

logger = logging.getLogger("streamlit_analytics2")
logger.setLevel(logging.DEBUG)

handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG)
logger.addHandler(handler)

@spolisar spolisar requested a review from 444B as a code owner November 14, 2024 23:15
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

Successfully merging this pull request may close these issues.

1 participant