Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Commit

Permalink
Logging tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Feb 7, 2014
1 parent bbf429c commit 4b7b467
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
9 changes: 9 additions & 0 deletions fedmsg.d/example-config.py
Expand Up @@ -11,4 +11,13 @@
"tcp://127.0.0.1:99887",
],
},
'logging': {
'loggers': {
'summershum': {
'handlers': ['console'],
'level': 'INFO',
'propagate': False
},
},
},
}
13 changes: 10 additions & 3 deletions summershum/consumer.py
@@ -1,14 +1,21 @@
import fedmsg.consumers
import summershum.utils

import logging
log = logging.getLogger("summershum")


class SummerShumConsumer(fedmsg.consumers.FedmsgConsumer):
topic = 'org.fedoraproject.prod.git.lookaside.new'
config_key = 'summershum.enabled'

def __init__(self, *args, **kwargs):
super(SummerShumConsumer, self).__init__(*args, **kwargs)
log.info("Ready for ingestion")

def consume(self, msg):
msg = msg['body']['msg']
self.log.info("Ingesting %r" % msg.get('filename'))
log.info("Ingesting %r" % msg.get('filename'))
fedmsg.publish(
topic='ingest.start',
msg=dict(original=msg),
Expand All @@ -17,7 +24,7 @@ def consume(self, msg):
summershum.utils.download_lookaside(msg)
summershum.utils.get_sha1sum(msg)
except Exception as e:
self.log.error("Failed to ingest %r %r" % (msg.get('filename'), e))
log.error("Failed to ingest %r %r" % (msg.get('filename'), e))
fedmsg.publish(
topic='ingest.fail',
msg=dict(
Expand All @@ -26,7 +33,7 @@ def consume(self, msg):
),
)
else:
self.log.info("Done ingesting %r" % msg.get('filename'))
log.info("Done ingesting %r" % msg.get('filename'))
fedmsg.publish(
topic='ingest.complete',
msg=dict(original=msg),
Expand Down

0 comments on commit 4b7b467

Please sign in to comment.