Skip to content

How to support structlog within a library? #179

Description

@adamcharnock

Firstly, thank you for writing structlog, I'm just reading into it now and it seems like a really useful tool.

I'm developing a Python library and I would like to support structlog, while not mandating it's use.

My thinking so far is that:

  • The developer (i.e. user of my library) should responsible for the logging setup
  • I will log key/value pairs with each log message to give extra context
  • If the developer uses structlog, they would get the benefit of seeing these key/value pairs
  • If the user does not use structlog, they regular log messages

I read through the stdlib section of the docs, but I couldn't quite divine the best way to proceed. Any advice you can offer would be a great help. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions