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


Python logging.VERBOSE属性代码示例

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


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

示例1: adjust_verbosity

# 需要导入模块: import logging [as 别名]
# 或者: from logging import VERBOSE [as 别名]
def adjust_verbosity(self, delta):
        """Set the logging verbosity relative to the COT default.

        Wrapper for :meth:`set_verbosity`, to be used when you have
        a delta (number of steps to offset more or less verbose)
        rather than an actual logging level in mind.

        Args:
          delta (int): Shift in verbosity level. 0 = default verbosity;
            positive implies more verbose; negative implies less verbose.
        """
        verbosity_levels = [
            logging.CRITICAL, logging.ERROR, logging.WARNING,  # quieter
            logging.NOTICE,                  # default
            logging.INFO, logging.VERBOSE,   # more verbose
            logging.DEBUG, logging.SPAM,     # really noisy
        ]
        verbosity = verbosity_levels.index(logging.NOTICE) + delta
        if verbosity < 0:
            verbosity = 0
        elif verbosity >= len(verbosity_levels):
            verbosity = len(verbosity_levels) - 1
        level = verbosity_levels[verbosity]
        self.set_verbosity(level) 
开发者ID:glennmatthews,项目名称:cot,代码行数:26,代码来源:cli.py

示例2: assertNoLogsOver

# 需要导入模块: import logging [as 别名]
# 或者: from logging import VERBOSE [as 别名]
def assertNoLogsOver(self, max_level, info=''):  # noqa: N802
        """Fail if any logs are logged higher than the given level.

        Args:
          max_level (int): Highest logging level to permit.
          info (str): Optional string to prepend to any failure messages.
        Raises:
          AssertionError: if any messages higher than max_level were seen
        """
        for level in (logging.CRITICAL, logging.ERROR, logging.WARNING,
                      logging.INFO, logging.VERBOSE, logging.DEBUG):
            if level <= max_level:
                return
            matches = self.logs(levelno=level)
            if matches:
                self.testcase.fail(
                    "{info}Found {len} unexpected {lvl} message(s):\n\n{msgs}"
                    .format(info=info,
                            len=len(matches),
                            lvl=logging.getLevelName(level),
                            msgs="\n\n".join([r['msg'] % r['args']
                                              for r in matches]))) 
开发者ID:glennmatthews,项目名称:cot,代码行数:24,代码来源:cot_testcase.py

示例3: handle_mpd

# 需要导入模块: import logging [as 别名]
# 或者: from logging import VERBOSE [as 别名]
def handle_mpd(self, mpd):
        original_mpd = copy.deepcopy(mpd)

        periods = mpd.findall('mpd:Period', ns)
        logger.log(logging.INFO, 'mpd=%s' % (periods,))
        logger.log(logging.VERBOSE, 'Found %d periods choosing the 1st one' % (len(periods),))
        period = periods[0]
        for as_idx, adaptation_set in enumerate( period.findall('mpd:AdaptationSet', ns) ):
            for rep_idx, representation in enumerate( adaptation_set.findall('mpd:Representation', ns) ):
                self.verbose('Found representation with id %s' % (representation.attrib.get('id', 'UKN'),))
                rep_addr = RepAddr(0, as_idx, rep_idx)
                self.ensure_downloader(mpd, rep_addr)

        self.write_output_mpd(original_mpd)

        minimum_update_period = mpd.attrib.get('minimumUpdatePeriod', '')
        if minimum_update_period:
            # TODO parse minimum_update_period
            self.refresh_mpd(after=10)
        else:
            self.info('VOD MPD. Nothing more to do. Stopping...') 
开发者ID:Viblast,项目名称:dash-proxy,代码行数:23,代码来源:dashproxy.py

示例4: verbose

# 需要导入模块: import logging [as 别名]
# 或者: from logging import VERBOSE [as 别名]
def verbose(self, msg, *args, **kwargs):
        """Log \a msg at 'verbose' level, debug < verbose < info"""
        self.log(logging.VERBOSE, msg, *args, **kwargs) 
开发者ID:nicfit,项目名称:eyeD3,代码行数:5,代码来源:log.py

示例5: configure_logger

# 需要导入模块: import logging [as 别名]
# 或者: from logging import VERBOSE [as 别名]
def configure_logger():
    global LOGGER_CONFIGURED, log
    if not LOGGER_CONFIGURED:

        logging.Logger.manager.loggerDict.clear()
        logging.VERBOSE = 5
        logging.addLevelName(logging.VERBOSE, 'VERBOSE')
        logging.Logger.verbose = lambda inst, msg, *args, **kwargs: inst.log(logging.VERBOSE, msg, *args, **kwargs)
        logging.verbose = lambda msg, *args, **kwargs: logging.log(logging.VERBOSE, msg, *args, **kwargs)

        log = logging.getLogger('log')
        log.setLevel(LOG_LVL)
        log_formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s')

        if LOG_TO_FILE:
            file_handler = logging.FileHandler(datetime.now().strftime(LOG_ROOT + 'learning_%Y_%m_%d_%H_%M_.log'))
            file_handler.setLevel(logging.INFO)
            file_handler.setFormatter(log_formatter)
            log.addHandler(file_handler)

        console_handler = logging.StreamHandler()
        console_handler.setFormatter(log_formatter)
        log.addHandler(console_handler)
        if PRINT_TO_LOG_CONVERT:
            builtins.print = log_print
        LOGGER_CONFIGURED = True 
开发者ID:fanci-dga-detection,项目名称:fanci,代码行数:28,代码来源:settings.py

示例6: __init__

# 需要导入模块: import logging [as 别名]
# 或者: from logging import VERBOSE [as 别名]
def __init__(self, verbosity=logging.INFO):
        """Create formatter for COT log output with the given verbosity."""
        format_string = "%(log_color)s"
        datefmt = None
        # Start with log level string
        format_items = ["%(levelname)-7s"]
        if verbosity <= logging.DEBUG:
            # Provide timestamps
            format_items.append("%(asctime)s.%(msecs)d")
            datefmt = "%H:%M:%S"
        if verbosity <= logging.INFO:
            # Provide module name
            # Longest module names at present:
            #   data_validation (15)
            #   edit_properties (15)
            #   install_helpers (15)
            format_items.append("%(module)-15s")
        if verbosity <= logging.DEBUG:
            # Provide line number, up to 4 digits
            format_items.append("%(lineno)4d")
        if verbosity <= logging.VERBOSE:
            # Provide function name
            # Pylint is configured to only allow func names up to 31 characters
            format_items.append("%(funcName)31s()")

        format_string += " : ".join(format_items)
        format_string += " :%(reset)s %(message)s"
        super(CLILoggingFormatter, self).__init__(format_string,
                                                  datefmt=datefmt,
                                                  reset=False,
                                                  log_colors=self.LOG_COLORS) 
开发者ID:glennmatthews,项目名称:cot,代码行数:33,代码来源:cli.py

示例7: verbose

# 需要导入模块: import logging [as 别名]
# 或者: from logging import VERBOSE [as 别名]
def verbose(self, msg):
        self.logger.log(logging.VERBOSE, msg) 
开发者ID:Viblast,项目名称:dash-proxy,代码行数:4,代码来源:dashproxy.py

示例8: run

# 需要导入模块: import logging [as 别名]
# 或者: from logging import VERBOSE [as 别名]
def run(args):
    logger.setLevel(logging.VERBOSE if args.v else logging.INFO)
    proxy = DashProxy(mpd=args.mpd,
                  output_dir=args.o,
                  download=args.d,
                  save_mpds=args.save_individual_mpds)
    return proxy.run() 
开发者ID:Viblast,项目名称:dash-proxy,代码行数:9,代码来源:dashproxy.py


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