You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that even if the message is not logged, the string will be evaluated. This can waste some processing time for messages that are never seen. To improve on this, the following is my proposal:
Notice the change from "..." % [...] to "...", [...]. Instead of doing the string interpolation in the message param, the logger receives both the string and the values to substitute. The string interpolation is only performed when the message actually gets logged.
Use case
This would be used in netfox addons for logging messages, so would affect all projects using netfox.
Upcoming features could also include more toggleabble logging without being concerned about wasted performance. The above time sync snippet is a good example.
Distribution
This would be an update in netfox.internals.
Notes
Code parts to consider:
_NetfoxLogger in netfox.internals
Search results for _NetfoxLogger.for_ and _NetfoxLogger.new - these should find all usages of the class
The change could be updating all logging methods to this signature:
funcinfo(message: String, values: Array= [])
Make sure that no interpolation is done if the array is empty! This should be a backwards-compatible refactor.
The text was updated successfully, but these errors were encountered:
✨ Description
Currently most, if not all, log messages are using string interpolation in the message param:
This means that even if the message is not logged, the string will be evaluated. This can waste some processing time for messages that are never seen. To improve on this, the following is my proposal:
Notice the change from
"..." % [...]
to"...", [...]
. Instead of doing the string interpolation in the message param, the logger receives both the string and the values to substitute. The string interpolation is only performed when the message actually gets logged.Use case
This would be used in netfox addons for logging messages, so would affect all projects using netfox.
Upcoming features could also include more toggleabble logging without being concerned about wasted performance. The above time sync snippet is a good example.
Distribution
This would be an update in
netfox.internals.
Notes
Code parts to consider:
_NetfoxLogger
in netfox.internals_NetfoxLogger.for_
and_NetfoxLogger.new
- these should find all usages of the classThe change could be updating all logging methods to this signature:
Make sure that no interpolation is done if the array is empty! This should be a backwards-compatible refactor.
The text was updated successfully, but these errors were encountered: