本文整理汇总了Python中logbook.NOTSET属性的典型用法代码示例。如果您正苦于以下问题:Python logbook.NOTSET属性的具体用法?Python logbook.NOTSET怎么用?Python logbook.NOTSET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类logbook
的用法示例。
在下文中一共展示了logbook.NOTSET属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_loggers
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import NOTSET [as 别名]
def set_loggers(config):
from rqalpha.utils.logger import user_log, user_system_log, user_detail_log, system_log, basic_system_log, std_log
from rqalpha.utils.logger import user_std_handler, init_logger
from rqalpha.utils import logger
extra_config = config.extra
init_logger()
for log in [basic_system_log, system_log, std_log, user_log, user_system_log, user_detail_log]:
log.level = getattr(logbook, config.extra.log_level.upper(), logbook.NOTSET)
if extra_config.log_level.upper() != "NONE":
if not extra_config.user_log_disabled:
user_log.handlers.append(user_std_handler)
if not extra_config.user_system_log_disabled:
user_system_log.handlers.append(user_std_handler)
for logger_name, level in extra_config.logger:
getattr(logger, logger_name).level = getattr(logbook, level.upper())
示例2: disable_logging
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import NOTSET [as 别名]
def disable_logging():
# Reset aiohttp logger
logger = logging.getLogger('aiohttp')
logger.removeHandler(_logger_redirect_handler)
logger.setLevel(logging.NOTSET)
# Reset asyncio logger
logger = logging.getLogger('asyncio')
logger.removeHandler(_logger_redirect_handler)
logger.setLevel(logging.NOTSET)
# Disable asyncio debug logging
del os.environ['PYTHONASYNCIODEBUG']
# Disable logger group
_logger_group.disabled = True
示例3: get_logger
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import NOTSET [as 别名]
def get_logger(name=None, level=logbook.NOTSET):
"""
Return a :class:`logbook.Logger`.
Arguments:
- `name`: The name of a specific sub-logger.
"""
base_name = 'threema.gateway'
name = base_name if name is None else '.'.join((base_name, name))
# Create new logger and add to group
logger = logbook.Logger(name=name, level=level)
_logger_group.add_logger(logger)
return logger
# TODO: Raises
示例4: __get_logbook_logging_level
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import NOTSET [as 别名]
def __get_logbook_logging_level(level_str):
# logbook levels:
# CRITICAL = 15
# ERROR = 14
# WARNING = 13
# NOTICE = 12
# INFO = 11
# DEBUG = 10
# TRACE = 9
# NOTSET = 0
level_str = level_str.upper().strip()
if level_str == 'CRITICAL':
return logbook.CRITICAL
elif level_str == 'ERROR':
return logbook.ERROR
elif level_str == 'WARNING':
return logbook.WARNING
elif level_str == 'NOTICE':
return logbook.NOTICE
elif level_str == 'INFO':
return logbook.INFO
elif level_str == 'DEBUG':
return logbook.DEBUG
elif level_str == 'TRACE':
return logbook.TRACE
elif level_str == 'NOTSET':
return logbook.NOTSET
else:
raise ValueError("Unknown logbook log level: {}".format(level_str))
示例5: get_logger
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import NOTSET [as 别名]
def get_logger(
name: Optional[str] = None,
level: Optional[LogbookLevel] = None,
) -> 'logbook.Logger':
"""
Return a :class:`logbook.Logger`.
Arguments:
- `name`: The name of a specific sub-logger. Defaults to
`saltyrtc`. If supplied, will be prefixed with `saltyrtc.`.
- `level`: A :mod:`logbook` logging level. Defaults to
:attr:`logbook.NOTSET`.
"""
if _logger_convert_level_handler is None:
_logging_error()
# At this point, logbook is either defined or an error has been returned
if level is None:
level = logbook.NOTSET
base_name = 'saltyrtc'
name = base_name if name is None else '.'.join((base_name, name))
# Create new logger and add to group
logger = logbook.Logger(name=name, level=level)
logger_group.add_logger(logger)
return logger
示例6: __init__
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import NOTSET [as 别名]
def __init__(self, filename, encoding='utf-8', level=logbook.NOTSET,
format_string=None, delay=False, max_size=1024 * 1024,
backup_count=5, filter=None, bubble=False):
self.max_size = max_size
self.backup_count = backup_count
super(FlockRotatingFileHandler, self).__init__(
filename, encoding=encoding, level=level,
format_string=format_string, delay=delay, filter=filter,
bubble=bubble)
self.flock = FlockFileLock(filename)
示例7: set_level
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import NOTSET [as 别名]
def set_level(self, log_level):
if log_level.lower() == LogLevel.INFO:
self.logger.level = logbook.INFO
elif log_level.lower() == LogLevel.WARNING:
self.logger.level = logbook.WARNING
elif log_level.lower() == LogLevel.CRITICAL:
self.logger.level = logbook.CRITICAL
elif log_level.lower() == LogLevel.NOTSET:
self.logger.level = logbook.NOTSET