more notifier magic
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
class Notifier:
|
||||
def __init__(self):
|
||||
self.output = open('notifier.log','at')
|
||||
pass
|
||||
def notify(self, msg):
|
||||
self.output.write(str(time.time())+"\n")
|
||||
self.output.write(str(msg)+"\n")
|
||||
self.output.flush()
|
||||
|
||||
self.output = open('/code/data/notifier.log','at')
|
||||
msg['address'] = msg['environment']['HTTP_X_FORWARDED_FOR']
|
||||
msg['date'] = datetime.now().isoformat()
|
||||
del msg['environment']
|
||||
self.output.write(json.dumps(msg, sort_keys = True)+"\n")
|
||||
self.output.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user