[Bugs] #1210 UNSP: let the logger do the formatting
SugarLabs Bugs
bugtracker-noreply at sugarlabs.org
Wed Aug 19 10:12:53 EDT 2009
#1210: let the logger do the formatting
------------------------------------------+---------------------------------
Reporter: sascha_silbe | Owner: tomeu
Type: defect | Status: new
Priority: Unspecified by Maintainer | Milestone: Unspecified by Release Team
Component: sugar | Version: Unspecified
Severity: Unspecified | Keywords: r?
Distribution: Unspecified | Status_field: New
------------------------------------------+---------------------------------
With the attached patch we delegate the string formatting to the logger
instead of doing it ourselves.
Advantages:
a) It's more robust: Constructs like 'debug("foo %r bar" % x)' are quite
common in our code and will break if x is a tuple. 'debug("foo %r bar",
x)' will work regardless of the type of x.
b) formatting only happens if we actually log something.
I haven't measured the impact of b) because a) is much more important to
me (happened a lot of times during the object_id => (tree_id, version_id)
conversion). At least one project has asked for pylint to flag these
occurences and gave performance as a reason for the change, though (so
they mave have measured it).
--
Ticket URL: <http://dev.sugarlabs.org/ticket/1210>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system
More information about the Bugs
mailing list