本文整理匯總了Python中logging.logProcesses方法的典型用法代碼示例。如果您正苦於以下問題:Python logging.logProcesses方法的具體用法?Python logging.logProcesses怎麽用?Python logging.logProcesses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類logging
的用法示例。
在下文中一共展示了logging.logProcesses方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: config_logging
# 需要導入模塊: import logging [as 別名]
# 或者: from logging import logProcesses [as 別名]
def config_logging(level=LEVEL, prefix=PREFIX, other_loggers=None):
# Little speed up
if "%(process)d" not in prefix:
logging.logProcesses = False
if "%(processName)s" not in prefix:
logging.logMultiprocessing = False
if "%(thread)d" not in prefix and "%(threadName)s" not in prefix:
logging.logThreads = False
handler = logging.StreamHandler()
handler.setFormatter(LogFormatter())
loggers = [logging.getLogger('pyftpdlib')]
if other_loggers is not None:
loggers.extend(other_loggers)
for logger in loggers:
logger.setLevel(level)
logger.addHandler(handler)
示例2: test_optional
# 需要導入模塊: import logging [as 別名]
# 或者: from logging import logProcesses [as 別名]
def test_optional(self):
r = logging.makeLogRecord({})
NOT_NONE = self.assertIsNotNone
if threading:
NOT_NONE(r.thread)
NOT_NONE(r.threadName)
NOT_NONE(r.process)
NOT_NONE(r.processName)
log_threads = logging.logThreads
log_processes = logging.logProcesses
log_multiprocessing = logging.logMultiprocessing
try:
logging.logThreads = False
logging.logProcesses = False
logging.logMultiprocessing = False
r = logging.makeLogRecord({})
NONE = self.assertIsNone
NONE(r.thread)
NONE(r.threadName)
NONE(r.process)
NONE(r.processName)
finally:
logging.logThreads = log_threads
logging.logProcesses = log_processes
logging.logMultiprocessing = log_multiprocessing
示例3: logf
# 需要導入模塊: import logging [as 別名]
# 或者: from logging import logProcesses [as 別名]
def logf(logger_func):
@wraps(logger_func)
def log_wrapper(*args):
if DEBUG:
logProcesses = logging.logProcesses
logThreads = logging.logThreads
logMultiprocessing = logging.logMultiprocessing
logging.logThreads = logging.logProcesses = logMultiprocessing = False
# disable logging pids and tids - we don't want extra calls around, especilly when we monkeypatch stuff
try:
return logger_func(*args)
finally:
logging.logProcesses = logProcesses
logging.logThreads = logThreads
logging.logMultiprocessing = logMultiprocessing
return log_wrapper
示例4: config_logging
# 需要導入模塊: import logging [as 別名]
# 或者: from logging import logProcesses [as 別名]
def config_logging(level=LEVEL, prefix=PREFIX, other_loggers=None):
# Little speed up
if "(process)" not in prefix:
logging.logProcesses = False
if "%(processName)s" not in prefix:
logging.logMultiprocessing = False
if "%(thread)d" not in prefix and "%(threadName)s" not in prefix:
logging.logThreads = False
handler = logging.StreamHandler()
formatter = LogFormatter()
formatter.PREFIX = prefix
handler.setFormatter(formatter)
loggers = [logging.getLogger('pyftpdlib')]
if other_loggers is not None:
loggers.extend(other_loggers)
for logger in loggers:
logger.setLevel(level)
logger.addHandler(handler)