docs(config): Clarify persist_logs behavior/opts

Clarify the `persist_logs:` options per [Discord discussion](https://discord.com/channels/994270357957648404/1409161361853780060/1409602529460879431).
This commit is contained in:
Ross Patterson 2025-08-25 13:10:33 -07:00
parent e50b25153f
commit 64e5b74102
No known key found for this signature in database
GPG key ID: 2EFF7CCE6828E359
3 changed files with 20 additions and 10 deletions

View file

@ -33,8 +33,17 @@ subscriptions.
persist_logs persist_logs
~~~~~~~~~~~~ ~~~~~~~~~~~~
Within ``configuration``, define whether logs from subscription downloads should be Without this key, ``ytdl-sub`` only prints output to it's ``stdout`` and ``stderr``. If
persisted. your configuration includes the ``persist_logs:`` key, then ``ytdl-sub`` also writes log
files to disk.
.. warning::
The log files grow rapidly if ``keep_successful_logs:`` is ``true``, the default, and
may fill up disk space. Set ``keep_successful_logs: false`` or prune the log files
regularly.
For example:
.. code-block:: yaml .. code-block:: yaml
@ -42,9 +51,6 @@ persisted.
persist_logs: persist_logs:
logs_directory: "/path/to/log/directory" logs_directory: "/path/to/log/directory"
Log files are stored as
``YYYY-mm-dd-HHMMSS.subscription_name.(success|error).log``.
.. autoclass:: ytdl_sub.config.config_validator.PersistLogsValidator() .. autoclass:: ytdl_sub.config.config_validator.PersistLogsValidator()
:members: :members:
:member-order: bysource :member-order: bysource

View file

@ -1,9 +1,9 @@
############################################################################### ###############################################################################
# Top-level configurations to apply umask and persist error logs # Top-level configurations to apply umask and write log files
configuration: configuration:
umask: "002" umask: "002"
persist_logs: persist_logs:
logs_directory: './logs' logs_directory: '/config/logs'
keep_successful_logs: False keep_successful_logs: False
presets: presets:
@ -98,4 +98,4 @@ presets:
overrides: overrides:
only_recent_date_range: "2months" only_recent_date_range: "2months"
only_recent_max_files: 30 only_recent_max_files: 30

View file

@ -67,7 +67,8 @@ class PersistLogsValidator(StrictDictValidator):
@property @property
def logs_directory(self) -> str: def logs_directory(self) -> str:
""" """
The directory to store the logs in. (required) Write log files to this directory with names like
``YYYY-mm-dd-HHMMSS.subscription_name.(success|error).log``. (required)
""" """
return self._logs_directory.value return self._logs_directory.value
@ -92,7 +93,10 @@ class PersistLogsValidator(StrictDictValidator):
@property @property
def keep_successful_logs(self) -> bool: def keep_successful_logs(self) -> bool:
""" """
Whether to store logs when downloading is successful. (default ``True``) If the ``persist_logs:`` key is in the configuration, then ``ytdl-sub`` *always*
writes log files for the subscription both for successful downloads and when it
encounters an error while downloading. When this key is ``False``, only write
log files for errors. (default ``True``)
""" """
return self._keep_successful_logs.value return self._keep_successful_logs.value