Change in vdsm[master]: log: failure in logging
nsoffer at redhat.com
nsoffer at redhat.com
Wed Oct 21 09:41:46 UTC 2015
Nir Soffer has posted comments on this change.
Change subject: log: failure in logging
......................................................................
Patch Set 3:
(2 comments)
https://gerrit.ovirt.org/#/c/47522/3/lib/yajsonrpc/betterAsyncore.py
File lib/yajsonrpc/betterAsyncore.py:
Line 134
Line 135
Line 136
Line 137
Line 138
> If no one is using it, then you should probably remove it... ?
Current python code does not use it, any future version may use it. If we override superclass methods, we should use the correct signature.
Piotr: you can tell by looking at asyncore.dispatcher code:
/usr/lib64/python2.7/asyncore.py
Line 140: def log_info(self, message, type='info'):
Line 141: level = getattr(logging, type.upper(), None)
Line 142: if not isinstance(level, int):
Line 143: raise ValueError('Invalid log level: %s' % type)
Line 144: self._log.log(level, message)
> I mean that _log is 'static' so why access it as 'self._log'.
self._log and Dispatcher._log are the same. The pythonic way is to access it as self._log - look at other vdsm code, nothing new here.
You don't want to create new logger for each instance, this is just a waste of memory. So you create one instance for the class and use it from the instance methods.
Same logic for other class attributes or for instance methods - they are stored in the class, accessed using self.name.
Line 145:
Line 146:
Line 147: class AsyncoreEvent(asyncore.file_dispatcher):
Line 148: def __init__(self, map=None):
--
To view, visit https://gerrit.ovirt.org/47522
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2396d1ec98987064134af334ff0a2a4dab78d836
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list