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/b82a26f5b80a09687b82d9b277b0b8ac1c104a2b/sedbgmux-shell.py#L311 https://gitea.osmocom.org/fixeria/sedbgmux/src/commit/b82a26f5b80a09687b82d9b277b0b8ac1c104a2b/sedbgmux-shell.py#L54 File pySim/log.py: https://gerrit.osmocom.org/c/pysim/+/41229/comment/616d417b_62814ea4?usp=email : 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=email : 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/b82a26f5b80a09687b82d9b277b0b8ac1c104a2b/sedbgmux/client.py#L33 And moreover, you get precise control over logging level for each module: https://gitea.osmocom.org/fixeria/sedbgmux/src/commit/b82a26f5b80a09687b82d9b277b0b8ac1c104a2b/sedbgmux-shell.py#L121 Does not mean you cannot have per-instance loggers though. -- To view, visit https://gerrit.osmocom.org/c/pysim/+/41229?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email Gerrit-MessageType: comment Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Change-Id: I187f117e7e1ccdb2a85dfdfb18e84bd7561704eb Gerrit-Change-Number: 41229 Gerrit-PatchSet: 6 Gerrit-Owner: dexter <[email protected]> Gerrit-Reviewer: Jenkins Builder Gerrit-CC: fixeria <[email protected]> Gerrit-CC: laforge <[email protected]> Gerrit-Attention: dexter <[email protected]> Gerrit-Comment-Date: Mon, 20 Oct 2025 18:12:48 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No
