added error logging
diff --git a/bin/Openbmc.py b/bin/Openbmc.py
index b320d52..9cfeffb 100644
--- a/bin/Openbmc.py
+++ b/bin/Openbmc.py
@@ -20,8 +20,6 @@
'NOT_PRESENT' : 3,
}
-EVENT_TYPES = ['NONE','FATAL','RECOVERABLE','WARNING','SW_ERROR','INFO']
-
ENUMS = {
'org.openbmc.SensorIntegerThreshold.state' :
diff --git a/bin/eventlogger.py b/bin/eventlogger.py
index 0c4fcfc..95edfb8 100644
--- a/bin/eventlogger.py
+++ b/bin/eventlogger.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
import sys
+import datetime
+import time
import syslog
import json
import gobject
@@ -12,24 +14,33 @@
DBUS_NAME = 'org.openbmc.loggers.EventLogger'
OBJ_NAME = '/org/openbmc/loggers/EventLogger/'+sys.argv[1]
+
class EventLogger(dbus.service.Object):
def __init__(self,bus,name):
dbus.service.Object.__init__(self,bus,name)
bus = dbus.SessionBus()
- syslog.openlog('openbmc')
-
bus.add_signal_receiver(self.event_log_signal_handler,
dbus_interface = "org.openbmc.EventLog",
signal_name = "EventLog",
path_keyword='path')
## Signal handler
- def event_log_signal_handler(self,e_type,msg,path = None):
+ def event_log_signal_handler(self,priority,msg,path = None):
message = {}
+ ts = time.time()
+
+ message['priority'] = priority
message['object_path'] = path
- message['e_type'] = Openbmc.EVENT_TYPES[int(e_type)]
message['message'] = msg
- syslog.syslog(json.dumps(message))
+
+ json_dump = json.dumps(message)
+ print "EVENT_LOG: "+json_dump
+ syslog.openlog('[OpenBmc]',logoption=syslog.LOG_PID)
+ syslog.syslog(priority,json_dump)
+ syslog.closelog()
+
+
+
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)