-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from odigos-io/silence-urllib3-logs
Silence urllib3 logs
- Loading branch information
Showing
4 changed files
with
52 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import logging | ||
|
||
|
||
# This is the main odigos-opentelemetry-python logger setup function. | ||
# It is used by all modules within this package to ensure that all logs are captured by the same logger. | ||
def setup_logging(): | ||
odigos_logger = logging.getLogger('odigos') | ||
odigos_logger.setLevel(logging.DEBUG) | ||
handler = logging.StreamHandler() | ||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') | ||
handler.setFormatter(formatter) | ||
odigos_logger.addHandler(handler) | ||
|
||
odigos_logger.propagate = False # Prevent logs from reaching the root logger | ||
odigos_logger.disabled = True # Comment to enable the logger | ||
|
||
# Suppress third-party loggers used by odigos-opentelemetry-python (before they are used) | ||
logging.getLogger('urllib3_odigos').setLevel(logging.CRITICAL) | ||
logging.getLogger('requests_odigos').setLevel(logging.CRITICAL) | ||
|
||
setup_logging() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters