mirror of
https://github.com/Kozea/Radicale.git
synced 2025-04-03 21:27:36 +03:00
Improve: suppress duplicate log lines on startup
This commit is contained in:
parent
59450e8c2d
commit
b356edd6be
2 changed files with 16 additions and 2 deletions
|
@ -3,6 +3,7 @@
|
||||||
## 3.3.3.dev
|
## 3.3.3.dev
|
||||||
* Add: display mtime_ns precision of storage folder with condition warning if too less
|
* Add: display mtime_ns precision of storage folder with condition warning if too less
|
||||||
* Improve: disable fsync during storage verification
|
* Improve: disable fsync during storage verification
|
||||||
|
* Improve: suppress duplicate log lines on startup
|
||||||
|
|
||||||
## 3.3.2
|
## 3.3.2
|
||||||
* Fix: debug logging in rights/from_file
|
* Fix: debug logging in rights/from_file
|
||||||
|
|
|
@ -221,18 +221,31 @@ def setup() -> None:
|
||||||
logger.error("Invalid RADICALE_LOG_FORMAT: %r", format_name)
|
logger.error("Invalid RADICALE_LOG_FORMAT: %r", format_name)
|
||||||
|
|
||||||
|
|
||||||
|
logger_display_backtrace_disabled: bool = False
|
||||||
|
logger_display_backtrace_enabled: bool = False
|
||||||
|
|
||||||
|
|
||||||
def set_level(level: Union[int, str], backtrace_on_debug: bool) -> None:
|
def set_level(level: Union[int, str], backtrace_on_debug: bool) -> None:
|
||||||
"""Set logging level for global logger."""
|
"""Set logging level for global logger."""
|
||||||
|
global logger_display_backtrace_disabled
|
||||||
|
global logger_display_backtrace_enabled
|
||||||
if isinstance(level, str):
|
if isinstance(level, str):
|
||||||
level = getattr(logging, level.upper())
|
level = getattr(logging, level.upper())
|
||||||
assert isinstance(level, int)
|
assert isinstance(level, int)
|
||||||
logger.setLevel(level)
|
logger.setLevel(level)
|
||||||
if level > logging.DEBUG:
|
if level > logging.DEBUG:
|
||||||
logger.info("Logging of backtrace is disabled in this loglevel")
|
if logger_display_backtrace_disabled is False:
|
||||||
|
logger.info("Logging of backtrace is disabled in this loglevel")
|
||||||
|
logger_display_backtrace_disabled = True
|
||||||
logger.addFilter(REMOVE_TRACEBACK_FILTER)
|
logger.addFilter(REMOVE_TRACEBACK_FILTER)
|
||||||
else:
|
else:
|
||||||
if not backtrace_on_debug:
|
if not backtrace_on_debug:
|
||||||
logger.debug("Logging of backtrace is disabled by option in this loglevel")
|
if logger_display_backtrace_disabled is False:
|
||||||
|
logger.debug("Logging of backtrace is disabled by option in this loglevel")
|
||||||
|
logger_display_backtrace_disabled = True
|
||||||
logger.addFilter(REMOVE_TRACEBACK_FILTER)
|
logger.addFilter(REMOVE_TRACEBACK_FILTER)
|
||||||
else:
|
else:
|
||||||
|
if logger_display_backtrace_enabled is False:
|
||||||
|
logger.debug("Logging of backtrace is enabled by option in this loglevel")
|
||||||
|
logger_display_backtrace_enabled = True
|
||||||
logger.removeFilter(REMOVE_TRACEBACK_FILTER)
|
logger.removeFilter(REMOVE_TRACEBACK_FILTER)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue