This makes using ConsoleRenderer without stdlib integration a little awkward. ConsoleRenderer looks for the logger key set by structlog.stdlib.add_logger_name, but we can't set that key as an initial value of a logger context (which would be useful with the default PrintLogger which doesn't store a name).
This might all be working as intended, or there might be a better way to do it - I'm finding structlog incredibly useful, thanks so much for writing it!
importstructlogstructlog.configure(processors=[structlog.dev.ConsoleRenderer()])
structlog.get_logger().info("works as expected", logger=__name__)
structlog.get_logger(logger=__name__).info("raises an exception")
works as expected [__main__]
Traceback (most recent call last):
File "logger.py", line 6, in <module>
structlog.get_logger(logger=__name__).info("raises an exception")
File "/home/sam/.local/share/virtualenvs/xerographer-dzaWO-xh/lib/python3.8/site-packages/structlog/_config.py", line 132, in get_logger
return wrap_logger(None, logger_factory_args=args, **initial_values)
TypeError: wrap_logger() got multiple values for argument 'logger'
The text was updated successfully, but these errors were encountered:
This makes using
ConsoleRenderer
without stdlib integration a little awkward.ConsoleRenderer
looks for thelogger
key set bystructlog.stdlib.add_logger_name
, but we can't set that key as an initial value of a logger context (which would be useful with the default PrintLogger which doesn't store a name).This might all be working as intended, or there might be a better way to do it - I'm finding structlog incredibly useful, thanks so much for writing it!
The text was updated successfully, but these errors were encountered: