Last active
September 1, 2025 20:06
-
-
Save yamatt/417db6bcb4ad4d378c304c53fbd06a07 to your computer and use it in GitHub Desktop.
Structlog Config
This file contains hidden or 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
| import uuid | |
| import structlog | |
| run_code = str(uuid.uuid4()) | |
| def add_run_code(logger, method_name, event_dict) -> dict: | |
| event_dict["run_code"] = run_code | |
| return event_dict | |
| structlog.configure( | |
| processors=[ | |
| structlog.stdlib.add_log_level, | |
| structlog.stdlib.PositionalArgumentsFormatter(), | |
| structlog.processors.TimeStamper(fmt="iso"), | |
| add_run_code, | |
| secret_to_secret_string, | |
| structlog.processors.JSONRenderer(), | |
| ] | |
| ) | |
| log = structlog.get_logger() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment