diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 420345b6..71670c68 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -1696,9 +1696,10 @@ _(>= 3.5.10)_ Log profiling data on level=info -Default: `per_request` +Default: `none` One of +* `none` (disabled) * `per_request` (above minimum duration) * `per_request_method` (regular interval) diff --git a/config b/config index 46b2f689..290fa368 100644 --- a/config +++ b/config @@ -322,8 +322,8 @@ #storage_cache_actions_on_debug = False # Log profiling data on level=info -# Value: per_request | per_request_method -#profiling = per_request_method +# Value: per_request | per_request_method | none +#profiling = none # Log profiling data per request minium duration (seconds) #profiling_per_request_min_duration = 3 diff --git a/radicale/config.py b/radicale/config.py index 5ec5908f..cf59bcd1 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -41,12 +41,12 @@ from radicale import auth, hook, rights, storage, types, web from radicale.hook import email from radicale.item import check_and_sanitize_props -from radicale import app # isort:skip (circular import issue) - DEFAULT_CONFIG_PATH: str = os.pathsep.join([ "?/etc/radicale/config", "?~/.config/radicale/config"]) +PROFILING: Sequence[str] = ("per_request", "per_request_method", "none") + def positive_int(value: Any) -> int: value = int(value) @@ -72,6 +72,12 @@ def logging_level(value: Any) -> str: return value +def profiling(value: Any) -> str: + if value not in PROFILING: + raise ValueError("unsupported profiling: %r" % value) + return value + + def filepath(value: Any) -> str: if not value: return "" @@ -584,10 +590,9 @@ This is an automated message. Please do not reply.""", "help": "log storage cache action on level=debug", "type": bool}), ("profiling", { - "value": "per_request_method", + "value": "none", "help": "log profiling data level=info", - "type": str, - "internal": app.PROFILING}), + "type": profiling}), ("profiling_per_request_min_duration", { "value": "3", "help": "log profiling data per request minimum duration (seconds)",