mirror of
https://github.com/certbot/certbot.git
synced 2026-06-06 07:12:54 -04:00
make logging output shorter
This commit is contained in:
parent
97ea1082ef
commit
2d6af52d21
3 changed files with 9 additions and 3 deletions
|
|
@ -51,6 +51,12 @@ def safe(what, s):
|
|||
else:
|
||||
return False
|
||||
|
||||
def short(thing):
|
||||
"""Return the first 8 bytes of a session ID, or, for a
|
||||
challenge ID, the challenge ID with the session ID truncated."""
|
||||
tmp = thing.partition(":")
|
||||
return tmp[0][:8] + ".." + tmp[1] + tmp[2]
|
||||
|
||||
sessions = redis.Redis()
|
||||
|
||||
class session(object):
|
||||
|
|
@ -367,7 +373,7 @@ class session(object):
|
|||
# TODO: Process challenge-related messages from the client.
|
||||
|
||||
def log(self, msg):
|
||||
sessions.publish("logs", "%s: %s" % (self.id, msg))
|
||||
sessions.publish("logs", "%s: %s" % (short(self.id), msg))
|
||||
if debug: print "%s: %s" % (self.id, msg)
|
||||
|
||||
def die(self, r, reason, uri=None):
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ def makechallenge(session):
|
|||
r.hset(challenge, "dvsni:ext", "1.3.3.7")
|
||||
# Keep accurate count of how many challenges exist in this session.
|
||||
r.hincrby(session, "challenges", 1)
|
||||
log("created new challenge %s" % challenge, session)
|
||||
log("created new challenge %s" % short(challenge), session)
|
||||
if True: # challenges have been created
|
||||
r.hset(session, "state", "testchallenge")
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ def testchallenge(session):
|
|||
all_satisfied = True
|
||||
for i, name in enumerate(r.lrange("%s:names" % session, 0, -1)):
|
||||
challenge = "%s:%d" % (session, i)
|
||||
log("testing challenge %s" % challenge, session)
|
||||
log("testing challenge %s" % short(challenge), session)
|
||||
challtime = int(r.hget(challenge, "challtime"))
|
||||
challtype = int(r.hget(challenge, "type"))
|
||||
name = r.hget(challenge, "name")
|
||||
|
|
|
|||
Loading…
Reference in a new issue