zephyr_mirror: Don't open /dev/null to disable logging
(imported from commit 804e627d6d70bbf2ae1ee2f467b79ed0582ced0f)
This commit is contained in:
parent
6329bb0a46
commit
3db339da35
|
@ -272,8 +272,9 @@ def process_notice(notice, log):
|
||||||
|
|
||||||
print "%s: zephyr=>humbug: received a message on %s/%s from %s..." % \
|
print "%s: zephyr=>humbug: received a message on %s/%s from %s..." % \
|
||||||
(datetime.datetime.now(), zephyr_class, notice.instance, notice.sender)
|
(datetime.datetime.now(), zephyr_class, notice.instance, notice.sender)
|
||||||
log.write(simplejson.dumps(zeph) + '\n')
|
if log is not None:
|
||||||
log.flush()
|
log.write(simplejson.dumps(zeph) + '\n')
|
||||||
|
log.flush()
|
||||||
|
|
||||||
res = send_humbug(zeph)
|
res = send_humbug(zeph)
|
||||||
if res.get("result") != "success":
|
if res.get("result") != "success":
|
||||||
|
@ -342,12 +343,10 @@ def zephyr_to_humbug(options):
|
||||||
print "%s: zephyr=>humbug: Starting receive loop." % (datetime.datetime.now(),)
|
print "%s: zephyr=>humbug: Starting receive loop." % (datetime.datetime.now(),)
|
||||||
|
|
||||||
if options.log_path is not None:
|
if options.log_path is not None:
|
||||||
log_file = options.log_path
|
with open(options.log_path, 'a') as log:
|
||||||
|
process_loop(log)
|
||||||
else:
|
else:
|
||||||
log_file = "/dev/null"
|
process_loop(None)
|
||||||
|
|
||||||
with open(log_file, 'a') as log:
|
|
||||||
process_loop(log)
|
|
||||||
|
|
||||||
def forward_to_zephyr(message):
|
def forward_to_zephyr(message):
|
||||||
zsig = u"%s@(@color(blue))" % (username_to_fullname(message["sender_email"]),)
|
zsig = u"%s@(@color(blue))" % (username_to_fullname(message["sender_email"]),)
|
||||||
|
|
Loading…
Reference in a new issue