Nir Soffer has uploaded a new change for review.

Change subject: logging: Unify SimpleLogAdapter format
......................................................................

logging: Unify SimpleLogAdapter format

SimpleLogAdapter was prefixing the log message with context info, using
"::" as message separator. This made sense when the log was using "::"
as field separator, but now we are using spaces.

Additionally the old format use strange quoting and no spacing between
pairs, making the format harder to read:

    task=`xxxyyy`res=`foo.bar.baz`::Message text ...

The new format fixes these issues and enclose the context info in
parenthesis to match the new log format:

    (task='xxxyyy', res='foo.bar.baz') Message text ...

This matches the format we used lately in many logs for adding message
details.

Here is an example log:
https://paste.fedoraproject.org/431636/raw/

Change-Id: Ib4edb64d214e515c9cfc45175f6cfee4340d28de
Signed-off-by: Nir Soffer <nsof...@redhat.com>
---
M lib/vdsm/logUtils.py
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/64227/1

diff --git a/lib/vdsm/logUtils.py b/lib/vdsm/logUtils.py
index 4c5ad8c..e726d9b 100644
--- a/lib/vdsm/logUtils.py
+++ b/lib/vdsm/logUtils.py
@@ -104,11 +104,11 @@
 
         Would produce this message::
 
-            "task=`xxxyyy`res=`foo.bar.baz`::Message"
+            "(task='xxxyyy', res='foo.bar.baz') Message"
         """
         self.logger = logger
-        items = "".join("%s=`%s`" % (k, v) for k, v in context.iteritems())
-        self.prefix = items + "::"
+        items = ", ".join("%s='%s'" % (k, v) for k, v in context.iteritems())
+        self.prefix = "(%s) " % items
 
     def process(self, msg, kwargs):
         return self.prefix + msg, kwargs


-- 
To view, visit https://gerrit.ovirt.org/64227
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4edb64d214e515c9cfc45175f6cfee4340d28de
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsof...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to