当前位置: 首页>>代码示例>>Python>>正文


Python Logger.debug方法代码示例

本文整理汇总了Python中utils.logger.Logger.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.debug方法的具体用法?Python Logger.debug怎么用?Python Logger.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在utils.logger.Logger的用法示例。


在下文中一共展示了Logger.debug方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import debug [as 别名]
class Configuration:
    
    def __init__(self, config_file = 'planner.ini'):
        self.logger = Logger().getLogger("configuration.Configuration")
        self._config_file = config_file
        current_directory = os.path.dirname(os.path.abspath(__file__))
        self._config_file_path = os.path.join(current_directory, '../etc/' + config_file)
        self.logger.debug('Initialize Configuration with ' + self._config_file_path)
        
        self.config = ConfigParser.ConfigParser()
        self.config.read(self._config_file_path)
    
    def get(self, section,option):
        if self.config.has_section(section) and self.config.has_option(section,option) :
            return self.config.get(section, option)
        else:
            return None
    
    def getDict(self, section,option):
        '''dict example: {1:'aaa',2:'bbb'}'''
        value = self.get(section, option)
        if value is not None:
            return ast.literal_eval(value)
        else:
            return value
开发者ID:vollov,项目名称:py-lab,代码行数:27,代码来源:__init__.py

示例2: UtLogger

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import debug [as 别名]
class UtLogger(unittest.TestCase):
    
    def setUp(self):
        self.logger = Logger().getLogger("test.utils.UtLogger")
        
    def testLogger(self):
        self.logger.debug("1")
        self.logger.info("2")
        self.logger.warn("3")
        self.logger.error("4")
        self.logger.critical("5")
开发者ID:vollov,项目名称:net-audit,代码行数:13,代码来源:ut_logger.py

示例3: TestLogger

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import debug [as 别名]
class TestLogger(unittest.TestCase):
   
    def setUp(self):
        self.logger = Logger().getLogger(__name__)
         
    def test_log(self):
        self.logger.debug("debug")
        self.logger.info("info")
        self.logger.warn("warn")
        self.logger.error("error")
        self.logger.critical("critical")
开发者ID:vollov,项目名称:flask-angularjs,代码行数:13,代码来源:test_logger.py

示例4: reset_buffer_metrics

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import debug [as 别名]
    def reset_buffer_metrics(self, time):
        """
        Resets the metrics used by the buffer to calculate average buffer time.
        Should be reset after updating the dynamic routing table.

        :param time: Time when the reset is happening
        :type time: float
        :return: Nothing
        :rtype: None
        """
        Logger.debug(time, "%s: Resetting buffer time." % self)
        self.entryTimes = {}
        self.avgBufferTime = 0
开发者ID:cs143-2015,项目名称:network-sim,代码行数:15,代码来源:link_buffer.py

示例5: Bar

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import debug [as 别名]
class Bar():
   
    def __init__(self):
        print 'Bar init()'
        self.logger = Logger().getLogger('utils.use_logger.Bar')
         
    def test_log(self):
        print 'Bar test_log()'
        self.logger.debug("debug")
        self.logger.info("info")
        self.logger.warn("warn")
        self.logger.error("error")
        self.logger.critical("critical")
开发者ID:vollov,项目名称:flask-angularjs,代码行数:15,代码来源:use_logger.py

示例6: do_collection

# 需要导入模块: from utils.logger import Logger [as 别名]
# 或者: from utils.logger.Logger import debug [as 别名]
def do_collection(collection, start_date, end_date):

    result_data = BytesIO()

    condition = {'result.publish_time': {'$gte': start_date, '$lte': end_date}}
    logging.info('search: {},{}'.format(collection.name, condition))

    total_samples = 0
    total_size = 0;
    #batch_content = leveldb.WriteBatch()
    for item in collection.find(condition):
        text = item['result']['text'].encode('utf-8')
        if len(text) == 0:
            continue

        url = item['url'].encode('utf-8')
        publish_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(item['result']['publish_time']))
        title = item['result'].get('title', '').encode('utf-8')
        sample_type = item['result']['type'].encode('utf-8')
        keyword = item['result']['extra'].get('keyword', '').encode('utf-8')

        sample = (url, sample_type, publish_time, url, keyword, title, text)
        sample_data = msgpack.packb(sample)
        total_size += len(sample_data)

        result_data.write(sample_data)

        total_samples += 1
        logging.debug(Logger.debug("%d [%s] %d %s" % (total_samples, publish_time, len(sample_data), title)))
        #sample_id = self.acquire_sample_id(1)
        #if sample_id % 1000 == 0:
            #print sample_id, title
        #sample_data = (sample_id, title, content)
        #rowstr = msgpack.dumps(sample_data)
        #batch_content.Put(str(sample_id), rowstr)

    #self.db.Write(batch_content, sync=True)

    logging.info(Logger.notice("Collected %d samples (size = %.3f MB)." % (total_samples, total_size / (1024 * 1024))))

    return result_data.getvalue()
开发者ID:uukuguy,项目名称:poc,代码行数:43,代码来源:data_collector.py


注:本文中的utils.logger.Logger.debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。