mirror of
https://github.com/thegeeklab/prometheus-pve-sd.git
synced 2024-06-10 11:40:52 +02:00
fix logging statement uses 'warn' instead of 'warning'
This commit is contained in:
parent
722733cd04
commit
6e08473507
|
@ -70,11 +70,11 @@ class MultilineJsonFormatter(jsonlogger.JsonFormatter):
|
|||
class Log:
|
||||
"""Handle logging."""
|
||||
|
||||
def __init__(self, level=logging.WARN, name="prometheuspvesd", log_format="console"):
|
||||
def __init__(self, level=logging.WARNING, name="prometheuspvesd", log_format="console"):
|
||||
self.logger = logging.getLogger(name)
|
||||
self.logger.setLevel(level)
|
||||
self.logger.addHandler(self._get_error_handler(log_format))
|
||||
self.logger.addHandler(self._get_warn_handler(log_format))
|
||||
self.logger.addHandler(self._get_warning_handler(log_format))
|
||||
self.logger.addHandler(self._get_info_handler(log_format))
|
||||
self.logger.addHandler(self._get_critical_handler(log_format))
|
||||
self.logger.addHandler(self._get_debug_handler(log_format))
|
||||
|
@ -102,10 +102,10 @@ class Log:
|
|||
|
||||
return handler
|
||||
|
||||
def _get_warn_handler(self, log_format):
|
||||
def _get_warning_handler(self, log_format):
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setLevel(logging.WARN)
|
||||
handler.addFilter(LogFilter(logging.WARN))
|
||||
handler.setLevel(logging.WARNING)
|
||||
handler.addFilter(LogFilter(logging.WARNING))
|
||||
|
||||
if log_format == "json":
|
||||
handler.setFormatter(MultilineJsonFormatter(JSON_FORMAT))
|
||||
|
@ -114,7 +114,7 @@ class Log:
|
|||
else:
|
||||
handler.setFormatter(
|
||||
MultilineFormatter(
|
||||
self.warn(
|
||||
self.warning(
|
||||
CONSOLE_FORMAT.format(
|
||||
colorama.Fore.YELLOW, colorama.Style.BRIGHT, colorama.Style.RESET_ALL
|
||||
)
|
||||
|
@ -196,7 +196,7 @@ class Log:
|
|||
|
||||
self.logger.setLevel(level)
|
||||
self.logger.addHandler(self._get_error_handler(log_level))
|
||||
self.logger.addHandler(self._get_warn_handler(log_level))
|
||||
self.logger.addHandler(self._get_warning_handler(log_level))
|
||||
self.logger.addHandler(self._get_info_handler(log_level))
|
||||
self.logger.addHandler(self._get_critical_handler(log_level))
|
||||
self.logger.addHandler(self._get_debug_handler(log_level))
|
||||
|
@ -213,8 +213,8 @@ class Log:
|
|||
"""Format error messages and return string."""
|
||||
return msg
|
||||
|
||||
def warn(self, msg):
|
||||
"""Format warn messages and return string."""
|
||||
def warning(self, msg):
|
||||
"""Format warning messages and return string."""
|
||||
return msg
|
||||
|
||||
def info(self, msg):
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
# D107: Missing docstring in __init__
|
||||
# D202: No blank lines allowed after function docstring
|
||||
# G001: Logging statements should not use string.format() for their first argument
|
||||
# G004: Logging statements should not use f"..." for their first argument
|
||||
# W503: Line break occurred before a binary operator
|
||||
ignore = D102, D103, D105, D107, D202, G001, W503
|
||||
ignore = D102, D103, D105, D107, D202, G001, G004, W503
|
||||
max-line-length = 99
|
||||
inline-quotes = double
|
||||
exclude = .git, __pycache__, build, dist, *.pyc, *.egg-info, .cache, .eggs, env*
|
||||
|
|
Loading…
Reference in New Issue
Block a user