diff --git a/server-ca/daemon_common.py b/server-ca/daemon_common.py index 42c1f8e1d..80a0cb146 100644 --- a/server-ca/daemon_common.py +++ b/server-ca/daemon_common.py @@ -2,9 +2,6 @@ # functions common to the various kinds of daemon -# TODO: define a log function that sends a pubsub message to the -# logger daemon - import time, binascii from Crypto import Random @@ -27,3 +24,9 @@ def random(): def random_raw(): """Return 32 random bytes.""" return Random.get_random_bytes(32) + +def log(msg, session = None): + if session: + r.publish("logs", "%s: %s" % (short(session), msg)) + else: + r.publish("logs", "%s" % session)