Attention is currently required from: Hoernchen, dexter, laforge.
lynxis lazus has posted comments on this change by Hoernchen. ( https://gerrit.osmocom.org/c/pysim/+/40468?usp=email )
Change subject: smdpp: less verbose by default ......................................................................
Patch Set 11:
(1 comment)
File osmo-smdpp.py:
https://gerrit.osmocom.org/c/pysim/+/40468/comment/3f22d345_a90cb5a9?usp=ema... : PS6, Line 370: logger.debug("Tx JSON: %s" % json.dumps(output)[:200])
I fail to understand what exactly we are now discussing here for a simple change from print to logge […]
1) logger.debug("foo %s" % json.dumps(output)[:200]) will always do the string.format() even in cases, when debug output isn't enabled. However logger.debug() supports doing it, when debug is enabled by: `logger.debug("foo %s", json.dumps(output)[:200])` (notice the , replaced the %).
Improves performance.
2) json.dumps() is a very expensive operation, because of this, I thought it would be worth checking, if it is a huge object, put it behind logger.isEnabledFor().
After a second look, I see the function is return the json object anyways as string, you could save the json object in a variable and use logger as described in 1) to have the best performance.