Attention is currently required from: Hoernchen, dexter, laforge.
1 comment:
File osmo-smdpp.py:
Patch Set #6, 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.
To view, visit change 40468. To unsubscribe, or for help writing mail filters, visit settings.