Tuesday, December 20, 2022

Python Log Level GR 3.10

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEHTK0yw4swSYopzttnG6iWViO/Q8FAmOhx9MACgkQnG6iWViO
/Q8ODg/+LWympmlzQqGutN5u41ELQBO/AsUS5LTTnYfoiJwL70e2u3hCsBRzuOce
pgvd83iSFwONxAQ65Fu4MtHmkkneRGpJEXAede4nuvEZkc5NtOx654sBlhcwI9Km
qs3LeZJwNs9C6C46Q3bHuUSHn24oIbwCFa2E1oQrKGD8HpItuYpZTcswbV747FLv
UXQ9to1XUJ/0+kX4OZdT5AZPIgcfT/4RvECFpBfH41UOyqjHmK1gyn0UbT4KyT4Y
H16C8CjWnkDHAM2SEIaXEQEtkswHbaQMVfUjr90Be6Ap0wiEZ3rwxe3HU1/XPOyS
M/WIc58DgUfestMs50BTGO1O+0upQ8HCeoCkX3nPhqVofN46xiUJrTuKrUU/JacT
GjS+ARtUdisKA7V8ZmZOkOUVw8DTB+nyl+CoLaY4wCCycg/i/MY18qCtXjAVbxXH
Ufxv05pkZFeOKpavuS6p3HJw48oN5Qf8i9Qa46OfIoDGz3vF0W+b1OpeVfUQNeVK
raS7Y803M0ayREVe0ePVerkSRCea4O+7rCFl3kNNkR+LufNfzSU+bkl0BybRxA+N
7JZd21EUcq4xsPvH8a9HQmrW5CzB4esSAyqCaTXFMXQvE10EI/5c8YAHbXtUjL5y
ZIyWbvGC3ZNpg3FNqpr5OFPddO2YOxeCxYnuFhjtA+1w1IsTusM=
=1kCI
-----END PGP SIGNATURE-----
I've been having trouble migrating my OOT module to GR 3.10 (currently testing with 3.10.5) due to the Python block logging levels not working as they did prior to 3.10.  Currently, I have a parameter on most of my blocks to selectively set the log level per block instance to help filter what is printing, however, it doesn't seem this works anymore.

The way I have it implemented is in the __init__ function of my blocks I run:
self.logger = gr.logger(self.alias())
self.logger.set_level(log_level)

Then elsewhere in the class issue logging statements as usual: self.logger.debug(f'some debug message')

In GR 3.9, this would print "some debug message" if that block's log_level was set to debug. However, now in 3.10 it appears nothing is being printed to stdout at all, regardless of log level.

I'm aware there have been some changes in the logger in 3.10, but the OOT porting guide suggests the only that need to be made are with the C++ logger (and that the old logging API still works—for now).

Are there any changes that must be made to the Python logger too?

Thanks in advance!
Jason

No comments:

Post a Comment