本文整理匯總了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