Ejemplo n.º 1
0
 def inner(command, **kwargs):
   caller_filename = sys._getframe(1).f_code.co_filename
   # quiet = can be False/True or None -- which means undefined yet
   quiet = kwargs['quiet'] if 'quiet' in kwargs else None
   is_internal_call = NOT_LOGGED_FOLDER in caller_filename
   
   if quiet == False or (quiet == None and not is_internal_call):
     command_repr = Logger._get_resource_name_repr(command)
     log_msg = Logger.get_function_repr("{0}[{1}]".format(function.__name__, command_repr), kwargs)
     Logger.info(log_msg)
     
   # logoutput=False - never log
   # logoutput=True - log in INFO level
   # logouput=None - log in DEBUG level
   # logouput=not-specified - log in DEBUG level, not counting internal calls
   kwargs['logoutput'] = ('logoutput' in kwargs and kwargs['logoutput'] and Logger.logger.isEnabledFor(logging.INFO)) or \
     ('logoutput' in kwargs and kwargs['logoutput']==None and Logger.logger.isEnabledFor(logging.DEBUG)) or \
     (not 'logoutput' in kwargs and not is_internal_call and Logger.logger.isEnabledFor(logging.DEBUG))
      
   result = function(command, **kwargs)
   
   if quiet == False or (quiet == None and not is_internal_call):
     log_msg = "{0} returned {1}".format(function.__name__, result)
     Logger.info(log_msg)
     
   return result
Ejemplo n.º 2
0
 def inner(command, **kwargs):
   caller_filename = sys._getframe(1).f_code.co_filename
   # quiet = can be False/True or None -- which means undefined yet
   quiet = kwargs['quiet'] if 'quiet' in kwargs else None
   is_internal_call = NOT_LOGGED_FOLDER in caller_filename
   
   if quiet == False or (quiet == None and not is_internal_call):
     command_repr = Logger._get_resource_name_repr(command)
     log_msg = Logger.get_function_repr("{0}[{1}]".format(function.__name__, command_repr), kwargs)
     Logger.info(log_msg)
     
   # logoutput=False - never log
   # logoutput=True - log in INFO level
   # logouput=None - log in DEBUG level
   # logouput=not-specified - log in DEBUG level, not counting internal calls
   if 'logoutput' in function.func_code.co_varnames:
     kwargs['logoutput'] = ('logoutput' in kwargs and kwargs['logoutput'] and Logger.logger.isEnabledFor(logging.INFO)) or \
       ('logoutput' in kwargs and kwargs['logoutput']==None and Logger.logger.isEnabledFor(logging.DEBUG)) or \
       (not 'logoutput' in kwargs and not is_internal_call and Logger.logger.isEnabledFor(logging.DEBUG))
      
   result = function(command, **kwargs)
   
   if quiet == False or (quiet == None and not is_internal_call):
     log_msg = "{0} returned {1}".format(function.__name__, result)
     Logger.info(log_msg)
     
   return result
Ejemplo n.º 3
0
 def __unicode__(self):
     return u"%s[%s]" % (self.__class__.__name__,
                         Logger._get_resource_name_repr(self.name))
Ejemplo n.º 4
0
 def __unicode__(self):
   return u"%s[%s]" % (self.__class__.__name__, Logger._get_resource_name_repr(self.name))