Skip to content

Instantly share code, notes, and snippets.

@hodbn
hodbn / urllib3_structlog.py
Created July 3, 2022 21:10
Structlog integration with urllib3
def setup_structlog(level: int = logging.DEBUG) -> None:
timestamper = structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M:%S")
shared_processors = [
structlog.stdlib.add_log_level,
timestamper,
]
structlog.configure(
processors=shared_processors
+ [
structlog.stdlib.ProcessorFormatter.wrap_for_formatter,

Keybase proof

I hereby claim:

  • I am hodbn on github.
  • I am hodbn (https://keybase.io/hodbn) on keybase.
  • I have a public key ASCqc6b27FKjxPh0zVSgaH1WcUWIiaWyW7kXW42usnvRlQo

To claim this, I am signing this object: