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


Python logging.TRACE属性代码示例

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


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

示例1: add_common_options

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def add_common_options(arg_parser, argv=None):
    argv = argv or sys.argv
    arg_parser.add_argument(
            '-q', '--quiet', dest='log_level', action='store_const',
            default=logging.INFO, const=logging.NOTICE, help='quiet logging')
    arg_parser.add_argument(
            '-v', '--verbose', dest='log_level', action='store_const',
            default=logging.INFO, const=logging.DEBUG, help=(
                'verbose logging'))
    arg_parser.add_argument(
            '--trace', dest='log_level', action='store_const',
            default=logging.INFO, const=logging.TRACE, help=(
                'very verbose logging'))
    # arg_parser.add_argument(
    #         '-s', '--silent', dest='log_level', action='store_const',
    #         default=logging.INFO, const=logging.CRITICAL)
    arg_parser.add_argument(
            '--version', action='version',
            version='brozzler %s - %s' % (
                brozzler.__version__, os.path.basename(argv[0]))) 
开发者ID:internetarchive,项目名称:brozzler,代码行数:22,代码来源:cli.py

示例2: format

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def format(self, record):
        try:
            msg = record.msg.split(':', 1)
            if len(msg) == 2:
                record.msg = '[%-12s]%s' % (msg[0], msg[1])
        except:
            pass
        levelname = record.levelname
        if record.levelno == logging.TRACE:
            levelname = 'TRACE'
            record.levelname = levelname
        if self.use_color and levelname in COLORS:
            levelname_color = (
                COLOR_SEQ % (30 + COLORS[levelname]) + levelname + RESET_SEQ)
            record.levelname = levelname_color
        return logging.Formatter.format(self, record) 
开发者ID:BillBillBillBill,项目名称:Tickeys-linux,代码行数:18,代码来源:logger.py

示例3: format

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def format(self, record):
        colors = {
            'CRITICAL': 'reverse_red',
            'ERROR': 'red',
            'WARNING': 'yellow',
            'SUCCESS': 'green',
            'INFO': 'cyan',
            'DEBUG': 'bright_grey',
            'TRACE': 'reverse_white',
        }
        color = colors.get(record.levelname, 'white')
        if self.name:
            return colored(record.levelname, color) + ': ' + self.name + ': ' + record.getMessage()
        else:
            return colored(record.levelname, color) + ': ' + record.getMessage()


################################################################################################### 
开发者ID:eegsynth,项目名称:eegsynth,代码行数:20,代码来源:EEGsynth.py

示例4: monkeypatch_trace

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def monkeypatch_trace(self: logging.Logger, msg: str, *args, **kwargs) -> None:
    """
    Log 'msg % args' with severity 'TRACE'.

    To pass exception information, use the keyword argument exc_info with
    a true value, e.g.

    logger.trace("Houston, we have an %s", "interesting problem", exc_info=1)
    """
    if self.isEnabledFor(TRACE_LEVEL):
        self._log(TRACE_LEVEL, msg, args, **kwargs) 
开发者ID:python-discord,项目名称:bot,代码行数:13,代码来源:__init__.py

示例5: _create_trace_loglevel

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def _create_trace_loglevel(logging):
    "Add TRACE log level and Logger.trace() method."

    logging.TRACE = 5
    logging.addLevelName(logging.TRACE, "TRACE")

    def _trace(logger, message, *args, **kwargs):
        if logger.isEnabledFor(logging.TRACE):
            logger._log(logging.TRACE, message, args, **kwargs)

    logging.Logger.trace = _trace 
开发者ID:dwavesystems,项目名称:dwave-hybrid,代码行数:13,代码来源:__init__.py

示例6: _apply_loglevel_from_env

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def _apply_loglevel_from_env(logger, env='DWAVE_HYBRID_LOG_LEVEL'):
    name = os.getenv(env) or os.getenv(env.upper()) or os.getenv(env.lower())
    if not name:
        return
    levels = {'trace': logging.TRACE, 'debug': logging.DEBUG, 'info': logging.INFO,
              'warning': logging.WARNING, 'error': logging.ERROR, 'critical': logging.CRITICAL}
    requested_level = levels.get(name.lower())
    if requested_level:
        logger.setLevel(requested_level) 
开发者ID:dwavesystems,项目名称:dwave-hybrid,代码行数:11,代码来源:__init__.py

示例7: __init__

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def __init__(self, **runopts):
        super(Runnable, self).__init__()

        self.runopts = runopts

        self.timers = defaultdict(list)
        self.timeit = make_timeit(self.timers, prefix=self.name, loglevel=logging.TRACE)

        self.counters = defaultdict(int)
        self.count = make_count(self.counters, prefix=self.name, loglevel=logging.TRACE) 
开发者ID:dwavesystems,项目名称:dwave-hybrid,代码行数:12,代码来源:core.py

示例8: __init__

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def __init__(self, name=None, loglevel=logging.TRACE):
        super(trace, self).__init__(name, loglevel) 
开发者ID:dwavesystems,项目名称:dwave-hybrid,代码行数:4,代码来源:profiling.py

示例9: test_init

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def test_init(self):
        self.assertTrue(hasattr(logging, 'TRACE'))
        self.assertEqual(getattr(logging, 'TRACE'), 5)

        logger = logging.getLogger(__name__)
        self.assertTrue(callable(logger.trace)) 
开发者ID:dwavesystems,项目名称:dwave-hybrid,代码行数:8,代码来源:test_core.py

示例10: trace

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def trace(self, msg, *args, **kwargs):
        """Set trace logging level

        Args:
            msg (str): The message to be logged.
        """
        self.log(logging.TRACE, msg, *args, **kwargs) 
开发者ID:ThreatConnect-Inc,项目名称:tcex,代码行数:9,代码来源:trace_logger.py

示例11: _logger

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def _logger(self):
        """Return the logger. The default_args property is not available in init."""
        logging.setLoggerClass(TraceLogger)
        logger = logging.getLogger(self.logger_name)
        logger.setLevel(logging.TRACE)
        return logger 
开发者ID:ThreatConnect-Inc,项目名称:tcex,代码行数:8,代码来源:logger.py

示例12: trace

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def trace(self, message, *args, **kwargs):
    """
    Verbose Debug Logging - Trace
    """
    if self.isEnabledFor(logging.TRACE):
        self._log(logging.TRACE, message, args, **kwargs) 
开发者ID:caronc,项目名称:apprise,代码行数:8,代码来源:logger.py

示例13: test_apprise_logger

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def test_apprise_logger():
    """
    API: Apprise() Logger

    """

    # Ensure we're not running in a disabled state
    logging.disable(logging.NOTSET)

    # Set our log level
    URLBase.logger.setLevel(logging.DEPRECATE + 1)

    # Deprication will definitely not trigger
    URLBase.logger.deprecate('test')

    # Verbose Debugging is not on at this point
    URLBase.logger.trace('test')

    # Set both logging entries on
    URLBase.logger.setLevel(logging.TRACE)

    # Deprication will definitely trigger
    URLBase.logger.deprecate('test')

    # Verbose Debugging will activate
    URLBase.logger.trace('test')

    # Disable Logging
    logging.disable(logging.CRITICAL) 
开发者ID:caronc,项目名称:apprise,代码行数:31,代码来源:test_logger.py

示例14: add_logging_level

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def add_logging_level(levelName, levelNum, methodName = None):
        """ Adds a new logging level to the `logging` module and the currently configured logging class.
        `levelName` becomes an attribute of the `logging` module with the value `levelNum`.
        `methodName` becomes a convenience method for both `logging` itself and the class returned by `logging.getLoggerClass()`
        (usually just `logging.Logger`). If `methodName` is not specified, `levelName.lower()` is used.

        To avoid accidental clobberings of existing attributes, this method will raise an `AttributeError` if the level name
        is already an attribute of the `logging` module or if the method name is already present .

        Example
        -------
        >>> add_logging_level('TRACE', logging.DEBUG - 5)
        >>> logging.getLogger(__name__).setLevel("TRACE")
        >>> logging.getLogger(__name__).trace('that worked')
        >>> logging.trace('so did this')
        >>> logging.TRACE
        5
        """

        if not methodName:
                methodName = levelName.lower()

        if hasattr(logging, levelName) or hasattr(logging, methodName) or hasattr(logging.getLoggerClass(), methodName):
                return

        def logForLevel(self, message, *args, **kwargs):
                if self.isEnabledFor(levelNum):
                        self._log(levelNum, message, args, **kwargs)
        def logToRoot(message, *args, **kwargs):
                logging.log(levelNum, message, *args, **kwargs)

        logging.addLevelName(levelNum, levelName)
        setattr(logging, levelName, levelNum)
        setattr(logging.getLoggerClass(), methodName, logForLevel)
        setattr(logging, methodName, logToRoot) 
开发者ID:SystemRage,项目名称:py-kms,代码行数:37,代码来源:pykms_Misc.py

示例15: __str__

# 需要导入模块: import logging [as 别名]
# 或者: from logging import TRACE [as 别名]
def __str__(self):
        return self.__repr__()

# monkey-patch log levels TRACE and NOTICE 
开发者ID:internetarchive,项目名称:brozzler,代码行数:6,代码来源:__init__.py


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