Dan Kenigsberg has posted comments on this change.

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


Patch Set 1: I would prefer that you didn't submit this

(4 inline comments)

but a happy step forward.

....................................................
File vdsm/logUtils.py
Line 45: 
Line 46: def call2str(func, args, kwargs, printers={}):
Line 47:     kwargs = kwargs.copy()
Line 48:     varnames = func.func_code.co_varnames[:func.func_code.co_argcount]
Line 49:     if hasattr(func, "im_func"):
suddenly you do not like ismethod()?
Line 50:         args = [func.im_self] + list(args)
Line 51:         func = func.im_func
Line 52: 
Line 53:     for name, val in zip(varnames, args):


Line 52: 
Line 53:     for name, val in zip(varnames, args):
Line 54:         kwargs[name] = val
Line 55: 
Line 56:     for name, val in zip(reversed(varnames), 
reversed(func.func_defaults) if func.func_defaults else []):
after several minutes I figured out why you reverse the lists.

zip( varnames[-len(func.func_defaults or []):], func.func_defaults or [])

would be clearer.
Line 57:         if name not in kwargs:
Line 58:             kwargs[name] = val
Line 59: 
Line 60:     argsStrs = []


Line 58:             kwargs[name] = val
Line 59: 
Line 60:     argsStrs = []
Line 61:     for argName in varnames:
Line 62:         if argName == "self":
not very nice, since "self" has no syntactic power. couldn't you behead 
varnames after line 49?
Line 63:             continue
Line 64: 
Line 65:         val = kwargs[argName]
Line 66:         printer = printers.get(argName, repr)


....................................................
File vdsm/storage/spm.py
Line 55: import fileUtils
Line 56: from processPool import Timeout
Line 57: import logUtils
Line 58: 
Line 59: logged = partial(logUtils.logcall, "dispatcher", "Run and protect: %s",
logged = hsm.logged would avoid the sin of code dup.
Line 60:         resPattern="Run and protect: %(name)s, Return response: 
%(result)s")
Line 61: 
Line 62: rmanager = rm.ResourceManager.getInstance()
Line 63: 


--
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: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to