dylanbstorey / pyo3-pylogger

log messages for pyo3 embedded Python applications using the logging module
Apache License 2.0
3 stars 2 forks source link

Feature Request: [Option to?] Retain Python Logger Names #4

Closed NfNitLoop closed 10 months ago

NfNitLoop commented 11 months ago

Context

I'm calling into a large-ish Python codebase from Rust. It consists of multiple packages, each of which uses a named Python logger for logs.

In Python, it's easy to see which logs come from which (named) logger, but in Rust, it appears that the name of the logger is ignored. So, if I init logging like this:

pyo3_pylogger::register("python");

All of the logs, from all of the various Python packages, end up with the same "python" prefix, and lose their individual contexts.

Request

Please include the python logger name in the output! IMO it should be present by default, but if you don't want to break backward compatibility, I suppose it could be opt-in.


Thanks for this library! 😊

NfNitLoop commented 11 months ago

This branch is working for me!

https://github.com/dylanbstorey/pyo3-pylogger/compare/main..NfNitLoop:pyo3-pylogger:with-logger-name

dylanbstorey commented 10 months ago

Will merge and release this evening. Thanks for contributing !

dylanbstorey commented 10 months ago

0.2.2 released, thanks for the PR