0

I'm using wrap_logger to wrap a logger which makes use of e.g. funcName.

When using log = wrap_logger(logger), funcName shows up as _proxy_to_logger instead of whatever function is making the log—so I'd like to ensure that stacklevel=2 gets passed to the underlying logger (in fact, I'd like to ensure this is the case without having to explicitly pass it on every call, but maybe that's for another ticket).

If I do something like log.info("This is a log", stacklevel=2) then structlog interprets this argument as a key-value pair to add to the event dictionary.

Anyone have any ideas?

AmagicalFishy
  • 1,249
  • 1
  • 12
  • 36
  • I wasn't aware of stacklevel and have opened an issue: https://github.com/hynek/structlog/issues/537 It's impossible to answer your question tho without knowing your configuration – it's _probably_ possible to hack it somehow together. – hynek Aug 02 '23 at 07:26

0 Answers0