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