ofp-parse: Fix padding parsing write-actions.
[sliver-openvswitch.git] / python / ovs / vlog.py
index ed95012..8447c0c 100644 (file)
@@ -1,5 +1,5 @@
 
-# Copyright (c) 2011, 2012 Nicira, Inc.
+# Copyright (c) 2011, 2012, 2013 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -60,9 +60,10 @@ class Vlog:
         if not Vlog.__inited:
             return
 
-        now = datetime.datetime.now().strftime("%b %d %H:%M:%S")
-        message = ("%s|%s|%s|%s|%s"
-                   % (now, Vlog.__msg_num, self.name, level, message))
+        dt = datetime.datetime.utcnow();
+        now = dt.strftime("%Y-%m-%dT%H:%M:%S.%%03iZ") % (dt.microsecond/1000)
+        syslog_message = ("%s|%s|%s|%s"
+                           % (Vlog.__msg_num, self.name, level, message))
 
         level = LEVELS.get(level.lower(), logging.DEBUG)
         Vlog.__msg_num += 1
@@ -70,6 +71,10 @@ class Vlog:
         for f, f_level in Vlog.__mfl[self.name].iteritems():
             f_level = LEVELS.get(f_level, logging.CRITICAL)
             if level >= f_level:
+                if f == "syslog":
+                    message = "ovs|" + syslog_message
+                else:
+                    message = "%s|%s" % (now, syslog_message)
                 logging.getLogger(f).log(level, message, **kwargs)
 
     def emer(self, message, **kwargs):