當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。