Change in vdsm[master]: Made the logging mechanism more generic

Saggi Mizrahi smizrahi at redhat.com
Sun Oct 16 08:01:44 UTC 2011


Saggi Mizrahi has posted comments on this change.

Change subject: Made the logging mechanism more generic
......................................................................


Patch Set 3: (2 inline comments)

....................................................
File vdsm/logUtils.py
Line 54:         kwargs[name] = val
Line 55: 
Line 56:     defaults = func.func_defaults if func.func_defaults else []
Line 57: 
Line 58:     for name, val in zip(varnames[-len(defaults):], defaults):
I don't reverse varnames
In [1]: a = [1,2,3]

In [2]: a[-2:]
Out[2]: [2, 3]
Line 59:         if name not in kwargs:
Line 60:             kwargs[name] = val
Line 61: 
Line 62:     argsStrs = []


Line 60:             kwargs[name] = val
Line 61: 
Line 62:     argsStrs = []
Line 63:     for i, argName in enumerate(varnames):
Line 64:         if i == 0 and argName == "self":
As I already told you I DON'T KNOW if the function is bounded or will it ever be bound. This is nice heuristic that work for 100% of our code. If someone names the first param something other then 'self' and binds it to an object the worst thing that will happen is that the param will get logged.
Line 65:             continue
Line 66: 
Line 67:         val = kwargs[argName]
Line 68:         printer = printers.get(argName, repr)


--
To view, visit http://gerrit.usersys.redhat.com/990
To unsubscribe, visit http://gerrit.usersys.redhat.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I38b4a16803b03043144acf62e9fb65c3b1b0a3c5
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Ayal Baron
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>


More information about the vdsm-patches mailing list