Attention is currently required from: dexter.
fixeria has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/41229?usp=email )
Change subject: pySim-shell: add a logger class to centralize logging ......................................................................
Patch Set 6:
(3 comments)
Patchset:
PS6: It would be nice to have a command line option `-v/--verbose` to increase logging verbosity of pySim-shell.py (and other apps). Here's an example from my pet project:
https://gitea.osmocom.org/fixeria/sedbgmux/src/commit/b82a26f5b80a09687b82d9... https://gitea.osmocom.org/fixeria/sedbgmux/src/commit/b82a26f5b80a09687b82d9...
File pySim/log.py:
https://gerrit.osmocom.org/c/pysim/+/41229/comment/616d417b_62814ea4?usp=ema... : PS6, Line 62: staticmethod You can use the `@classmethod` instead, which allows to reference "this class".
``` @classmethod def _log_callback(cls, message, record): if not cls.print_callback: # ... ```
File pySim/runtime.py:
https://gerrit.osmocom.org/c/pysim/+/41229/comment/c5e552fe_003d2042?usp=ema... : PS6, Line 48: self.log = PySimLogger.get("RuntimeState") A more usual approach is to have a module-local logger:
``` log = PySimLogger.get(__name__) ```
This way all functions and classes can use it. For example:
https://gitea.osmocom.org/fixeria/sedbgmux/src/commit/b82a26f5b80a09687b82d9...
And moreover, you get precise control over logging level for each module:
https://gitea.osmocom.org/fixeria/sedbgmux/src/commit/b82a26f5b80a09687b82d9...
Does not mean you cannot have per-instance loggers though.