On Tue, 2026-07-21 at 11:27 +0100, Nathan Williams via dev wrote: > Following up on the second question, I've done some additional > experimentation and setup the warnings lib with appropriate > fatal_warnings and messenger which looks something like this: > https://github.com/apache/buildstream/commit/2464820b5fc11db34b51920bbb35929205ff2e41#diff-d7040f76f364bdd85649f70597d185b20ad7b995953f8d80ae61e71a1592cfb3R890-R891 >
I think something like this may be a reasonable approach to be able to log warnings from code without access to the Context (without completely replacing the logging system), although we can hopefully do something better for the category. I don't know whether it would be easy to make this work properly also when a warning is issued from a plugin context. That warning should show up with the plugin name in the log and should also be logged to the right log file. If this is not (easily) possible, we should at least try to make sure it can't cause any confusion between global and plugin/element-specific log messages (or concurrency issues). Maybe the `catch_warnings` context manager would be helpful: https://docs.python.org/3/library/warnings.html#warnings.catch_warnings Jürg
