diff options
author | Dan McGee <dan@archlinux.org> | 2011-01-31 15:10:48 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-01-31 15:10:48 -0600 |
commit | 0bb5e9fd6dfa5f5e3be8a9e9c7f0f7ea8ec37733 (patch) | |
tree | 4d71828af55b7b631c0cd9623567ce83952a09e8 /mirrors/management/commands/mirrorresolv.py | |
parent | 7d043be0b3d090d2f675af5b86856693aa73e787 (diff) |
Defer format string substitution to logger
Don't use 'fmtstr % (arg1, arg2)' type format; logger can be passed a format
string and the arguments to populate it. Saves a bit of work for strings
that never end up getting displayed anyway.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/management/commands/mirrorresolv.py')
-rw-r--r-- | mirrors/management/commands/mirrorresolv.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mirrors/management/commands/mirrorresolv.py b/mirrors/management/commands/mirrorresolv.py index bcb24a52..8cbd51a3 100644 --- a/mirrors/management/commands/mirrorresolv.py +++ b/mirrors/management/commands/mirrorresolv.py @@ -43,13 +43,15 @@ def resolve_mirrors(): for mirrorurl in MirrorUrl.objects.filter(mirror__active=True): try: hostname = urlparse(mirrorurl.url).hostname - logger.debug("resolving %3i (%s)" % (mirrorurl.id, hostname)) + logger.debug("resolving %3i (%s)", mirrorurl.id, hostname) info = socket.getaddrinfo(hostname, None, 0, socket.SOCK_STREAM) families = [x[0] for x in info] mirrorurl.has_ipv4 = socket.AF_INET in families mirrorurl.has_ipv6 = socket.AF_INET6 in families + logger.debug("%s: v4: %s v6: %s", hostname, + mirrorurl.has_ipv4, mirrorurl.has_ipv6) mirrorurl.save() except socket.error, e: - logger.warn("error resolving %s: %s" % (hostname, e)) + logger.warn("error resolving %s: %s", hostname, e) # vim: set ts=4 sw=4 et: |