コード例 #1
0
ファイル: shell.py プロジェクト: liangfei/ambari
 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
コード例 #2
0
ファイル: shell.py プロジェクト: OpenPOWER-BigData/HDP-ambari
 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 = RMF_FOLDER in caller_filename
   
   if quiet == False or (quiet == None and not is_internal_call):
     command_alias = string_cmd_from_args_list(command) if isinstance(command, (list, tuple)) else command
     log_msg = Logger.get_function_repr("{0}['{1}']".format(function.__name__, command_alias), 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
コード例 #3
0
ファイル: shell.py プロジェクト: soener/ambari
    def inner(command, **kwargs):
        caller_filename = inspect.getouterframes(inspect.currentframe())[1][1]
        # quiet = can be False/True or None -- which means undefined yet
        quiet = kwargs['quiet'] if 'quiet' in kwargs else None
        is_internal_call = RMF_FOLDER in caller_filename

        if quiet == False or (quiet == None and not is_internal_call):
            command_alias = string_cmd_from_args_list(command) if isinstance(
                command, (list, tuple)) else command
            log_msg = Logger.get_function_repr(
                "{0}['{1}']".format(function.__name__, command_alias), 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
コード例 #4
0
ファイル: shell.py プロジェクト: maduhu/HDP2.5-ambari
 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