當前位置: 首頁>>代碼示例>>Python>>正文


Python Logger.debug方法代碼示例

本文整理匯總了Python中misc.Logger.debug方法的典型用法代碼示例。如果您正苦於以下問題:Python Logger.debug方法的具體用法?Python Logger.debug怎麽用?Python Logger.debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在misc.Logger的用法示例。


在下文中一共展示了Logger.debug方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Serializer

# 需要導入模塊: from misc import Logger [as 別名]
# 或者: from misc.Logger import debug [as 別名]
class Serializer(object):
    """
        Should be responsible for representing instances of classes in desired form
    """
    def __init__(self):
        self.log = Logger().get_logger()
        self.log.debug("Instantiated Serializer with data %s" % self.data_hash)
        pass

    def __repr__(self):
        return str(self.data_hash)

    def __str__(self):
        return self.data_hash

    def _assign_attributes(self):
        """
            Should change the key names from original API keys to the ones we want
            :return: None
        """
        for new_key, old_key in self.attributes.iteritems():
            try:
                self.data[new_key] = self.data_hash[old_key]
            except SerializerException, e:
                """ possible do something fancy here """
            except Exception, e:
                self.log.info("Could not assign attribute %s while operating on Object: %s because %s" % (old_key, self.data_hash, e))
開發者ID:EndPointCorp,項目名稱:interactivespaces-python-api,代碼行數:29,代碼來源:serializer.py

示例2: Master

# 需要導入模塊: from misc import Logger [as 別名]
# 或者: from misc.Logger import debug [as 別名]
class Master(Communicable):
    """
        @summary: This is the main class with all the logic needed for 
        high level stuff. You will typically use instance of Master for all your scripts.
    """
    def __init__(self, host='lg-head', port='8080', prefix='/interactivespaces'):
        """ 
            @param host: default value is lg-head 
            @param port: default value is 8080
            @param prefix: default value is /interactivespaces
            @todo: refactor filter_* methods because they're not DRY
        """
        self.host, self.port, self.prefix = host, port, prefix
        self.log = Logger().get_logger()
        self.uri = "http://%s:%s%s" % (self.host, self.port, prefix)
        super(Master, self).__init__()
        
    def get_activities(self, search_pattern=None):
        """
            Retrieves a list of Activity objects
            @rtype: list
            @param search_pattern: dictionary of regexps used for searching through Activities
                - example regexp dict: {
                                        "activity_name" : "regexp",
                                        "activity_version" : "regexp" 
                                        }
                - every search_pattern dictionary key may be blank/null
        """
        url = self._compose_url(class_name='Master', method_name='get_activities', uri=self.uri)
        self.log.info("Trying to retrieve url=%s" % url)
        response = self._api_get_json(url)
        self.log.info('Got response for "get_activities" %s ' % str(response))
        self.log.info('get_activities returned %s objects' % str(len(response)))
        activities = self._filter_activities(response, search_pattern)
        return activities

    def get_activity(self, search_pattern=None):
        """
            Retrieves a list of Activity objects
            @rtype: list
            @param search_pattern: dictionary of regexps used for searching through Activities
                - example regexp dict: {
                                        "activity_name" : "regexp",
                                        "activity_version" : "regexp" 
                                        }
                - every search_pattern dictionary key may be blank/null
        """
        url = self._compose_url(class_name='Master', method_name='get_activities', uri=self.uri)
        self.log.info("Trying to retrieve url=%s" % url)
        response = self._api_get_json(url)
        self.log.info('Got response for "get_activities" %s ' % str(response))
        self.log.info('get_activities returned %s objects' % str(len(response)))
        activity = self._filter_activities(response, search_pattern)
        if len(activity) > 1:
            raise MasterException("get_activity returned more than one row (%s)" % len(activity))
        elif isinstance(activity[0], Activity):
            activity[0].fetch()
            self.log.info("get_activity returned Activity:%s" % str(activity))
            return activity
        else:
            raise MasterException("Could not get specific activity for given search pattern")
    
    def get_live_activities(self, search_pattern=None):
        """
            Retrieves a list of LiveActivity objects
            @rtype: list
            @param search_pattern: dictionary of regexps used for searching through LiveActivity names
                - example regexp dict: {
                                        "live_activity_name" : "regexp",
                                        "space_controller_name" : "regexp"
                                        }
                - each search_pattern dictionary key may be blank/null
        """
        url = self._compose_url(class_name='Master', method_name='get_live_activities', uri=self.uri)
        self.log.info("Trying to retrieve url=%s" % url)
        response = self._api_get_json(url)
        self.log.debug('Got response for "get_live_activities" %s ' % str(response))
        self.log.info('get_live_activities returned %s objects' % str(len(response)))
        live_activities = self._filter_live_activities(response, search_pattern)
        return live_activities
    
    def get_live_activity(self, search_pattern=None):
        """
            Retrieves a list of LiveActivity objects
            @rtype: LiveActivity or False
            @param search_pattern: dictionary of regexps used for searching through LiveActivity names
                - example regexp dict: {
                                        "live_activity_name" : "GE ViewSync Master on Node A",
                                        "space_controller_name" : "ISCtlDispAScreen00"
                                        }
                - each search_pattern dictionary key may be blank/null
        """
        url = self._compose_url(class_name='Master', method_name='get_live_activities', uri=self.uri)
        self.log.info("Trying to retrieve url=%s" % url)
        response = self._api_get_json(url)
        self.log.debug('Got response for "get_live_activities" %s ' % str(response))
        self.log.info('get_live_activities returned %s objects' % str(len(response)))
        live_activity = self._filter_live_activities(response, search_pattern)
        if len(live_activity) > 1:
            raise MasterException("get_live_activity returned more than one row (%s)" % len(live_activity))
#.........這裏部分代碼省略.........
開發者ID:wzin,項目名稱:interactivespaces-python-api,代碼行數:103,代碼來源:master.py

示例3: Master

# 需要導入模塊: from misc import Logger [as 別名]
# 或者: from misc.Logger import debug [as 別名]
class Master(Communicable):
    """
    This is the main class with all the logic needed for
    high level stuff. You will typically use instance of
    Master for all your scripts.
    """
    def __init__(self, host='lg-head', port='8080', prefix='/interactivespaces', logfile_path='ispaces-client.log'):
        """
        :param host: default value is lg-head
        :param port: default value is 8080
        :param prefix: default value is /interactivespaces
        :todo: refactor filter_* methods because they're not DRY
        """
        self.host, self.port, self.prefix = host, port, prefix
        self.log = Logger(logfile_path=logfile_path).get_logger()
        self.uri = "http://%s:%s%s" % (self.host, self.port, prefix)
        super(Master, self).__init__()

    def get_activities(self, search_pattern=None):
        """
        Retrieves a list of Activity objects

        :rtype: list

        :param search_pattern: dictionary of regexps used for searching through Activities

        example regexp dict::

            {\
            "activity_name" : "regexp"\
            "activity_version" : "regexp"\
            }

        every search_pattern dictionary key may be blank/null
        """
        url = self._compose_url(class_name='Master', method_name='get_activities', uri=self.uri)
        self.log.info("Trying to retrieve url=%s" % url)
        response = self._api_get_json(url)
        self.log.info('Got response for "get_activities" %s ' % str(response))
        self.log.info('get_activities returned %s objects' % str(len(response)))
        activities = self._filter_activities(response, search_pattern)
        return activities

    def get_activity(self, search_pattern=None):
        """
        Retrieves a list of Activity objects

        :rtype: list

        :param search_pattern: dictionary of regexps used for searching through Activities

        example regexp dict::

            {\
            "activity_name" : "regexp",\
            "activity_version" : "regexp"\
            }

        every search_pattern dictionary key may be blank/null
        """
        url = self._compose_url(class_name='Master', method_name='get_activities', uri=self.uri)
        self.log.info("Trying to retrieve url=%s" % url)
        response = self._api_get_json(url)
        self.log.info('Got response for "get_activities" %s ' % str(response))
        self.log.info('get_activities returned %s objects' % str(len(response)))
        activity = self._filter_activities(response, search_pattern)

        return self._validate_single_getter_results(activity, Activity, ActivityNotFoundException)

    def get_live_activities(self, search_pattern=None):
        """
        Retrieves a list of LiveActivity objects

        :rtype: list

        :param search_pattern: dictionary of regexps used for searching through LiveActivity names

        example regexp dict::

            {\
            "live_activity_name" : "regexp",\
            "space_controller_name" : "regexp"\
            }

        - each search_pattern dictionary key may be blank/null
        """
        url = self._compose_url(class_name='Master', method_name='get_live_activities', uri=self.uri)
        self.log.info("Trying to retrieve url=%s" % url)
        response = self._api_get_json(url)
        self.log.debug('Got response for "get_live_activities" %s ' % str(response))
        self.log.info('get_live_activities returned %s objects' % str(len(response)))
        live_activities = self._filter_live_activities(response, search_pattern)
        return live_activities

    def get_live_activity(self, search_pattern=None):
        """
        Retrieves a list of LiveActivity objects

        :rtype: LiveActivity or False

#.........這裏部分代碼省略.........
開發者ID:EndPointCorp,項目名稱:interactivespaces-python-api,代碼行數:103,代碼來源:master.py


注:本文中的misc.Logger.debug方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。