{# Log settings in three levels (Hani #1 2026-10-24): Settings › Logs for all ecosystems, then an ecosystem, then a device. A value equal to the level above follows it; a different one overrides it for this level and the ones below. #} {% macro log_levels_form(v, parent, action, scope, csrf, reset_action=none, can_edit=true, names=none) %} {% set names = names or {'portal': 'all ecosystems (Settings › Logs)', 'ecosystem': 'its ecosystem', 'device': 'this device'} %} {% set s = v %} {% macro origin(field) %}{% if v.get('from') %}{{ 'Set here' if v['from'][field] == scope else 'From ' ~ names[v['from'][field]] }}{% endif %}{% endmacro %} {% if can_edit %}
{{ origin('enabled') }}
{{ origin('daily_files') }}

{% if scope == 'device' %}A value equal to the one this device would follow (its ecosystem's, else Settings › Logs) keeps following it; a different value applies to this device only.{% elif scope == 'ecosystem' %}A value equal to Settings › Logs keeps following it; a different value applies to this ecosystem's devices, unless a device has its own.{% else %}These apply to every ecosystem and device, unless an ecosystem or a device has its own.{% endif %}

{% if reset_action and v.get('from') and scope in v['from'].values() %}
{% endif %} {% else %}
Logs
{{ 'kept' if s.enabled else 'not kept' }}
Per device
{{ s.rate }} messages a second, {{ s.daily_mb }} MB a day
On the Portal
{{ s.local_days }} days
Sign-in events
{{ s.security_days }} days
{% endif %} {% endmacro %}