Previously, during early-startup (until configure_logging(config) is called in run_electrum), - the stderr log handler lost all log messages below warning level, and - the file log handler lost all log messages regardless of log level We now instead start buffering log messages in memory as soon as electrum.logging is imported. The buffer is dumped into the stderr and file log handlers when they are fully set up, and then the buffer is discarded (and the temporary log handler is removed). Note that messages are not logged until configure_logging() is called. Previously WARNING/ERROR messages would get logged immediately to stderr, but not anymore. This was changed so that the order of the log messages can be kept intact. (if we log WARNINGs immediately, but need to delay INFOs until the config is available, messages would either be out of order or alternatively there would be duplicates) Relatedly, we now follow the recommendation of the python docs re logging for libraries [0]: we try to only configure logging if running via run_electrum (the main script) and not when e.g. a 3rd party script imports electrum. [0]: https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library
17 KiB
Executable File
17 KiB
Executable File