Loading cloudcontrol/common/helpers/__init__.py Empty file added. cloudcontrol/common/helpers/logger.py +30 Changes for cloudcontrol/common/helpers/logger.py: 30 added lines, 0 removed lines. Original line number Diff line number Diff line """ Logging helpers. """ import types # This function is taken from logging package from Python stdlib v2.7. def getChild(self, suffix): """ Get a logger which is a descendant to this one. This is a convenience method, such that logging.getLogger('abc').getChild('def.ghi') is the same as logging.getLogger('abc.def.ghi') It's useful, for example, when the parent logger is named using __name__ rather than a literal string. """ if self.root is not self: suffix = '.'.join((self.name, suffix)) return self.manager.getLogger(suffix) def patch_logging(): import logging logging.Logger.getChild = types.UnboundMethodType(getChild, None, logging.Logger) Loading
cloudcontrol/common/helpers/logger.py +30 Changes for cloudcontrol/common/helpers/logger.py: 30 added lines, 0 removed lines. Original line number Diff line number Diff line """ Logging helpers. """ import types # This function is taken from logging package from Python stdlib v2.7. def getChild(self, suffix): """ Get a logger which is a descendant to this one. This is a convenience method, such that logging.getLogger('abc').getChild('def.ghi') is the same as logging.getLogger('abc.def.ghi') It's useful, for example, when the parent logger is named using __name__ rather than a literal string. """ if self.root is not self: suffix = '.'.join((self.name, suffix)) return self.manager.getLogger(suffix) def patch_logging(): import logging logging.Logger.getChild = types.UnboundMethodType(getChild, None, logging.Logger)