Unable to change logging level for pyscript
The logs are littered with debug trigger prints for every trigger triggered and skipped. While I like this, it would be nice to have the default logging level as INFO instead of DEBUG and the documented way to change it.
2026-04-13 12:52:11.835 DEBUG (MainThread) [custom_components.pyscript.file.sun_autowindow] Trigger not active due to @time_active(range(13:30, 20:15))
2026-04-13 12:48:41.586 DEBUG (MainThread) [custom_components.pyscript.file.xiaomi_wireless_buttons] trigger file.xiaomi_wireless_buttons.button_2_double got @mqtt_trigger(zigbee2mqtt_slzb/xiaomi_wireless_button_2,payload_obj['action'] == 'double') trigger, running action (kwargs = {'trigger_type': 'mqtt', 'topic': 'zigbee2mqtt_slzb/xiaomi_wireless_button_2', 'payload': '{"action":"double","battery":100,"device":
via https://github.com/custom-components/pyscript/pull/818 ping @dmamelin
In the legacy implementation, this was logged at the system level in the debug channel:
DEBUG (MainThread) [custom_components.pyscript.trigger] trigger file.test_exc.test got mqtt trigger, but not active
In the new implementation, it is logged at the user-code level, which seemed more logical to me:
DEBUG (MainThread) [custom_components.pyscript.file.test_exc] Trigger not active due to @time_active(range(13:30, 13:45))
I don't think info is the right level here - it could easily flood the logs.
For example, I have sensors that update several times per second, and I suppress that with @time_active(hold_off=30).
The logging level can be changed through configuration.yaml.
logger:
default: info
logs:
custom_components.pyscript.file.test_exc: debug
custom_components.pyscript.file.sun_autowindow: debug
custom_components.pyscript.file.xiaomi_wireless_buttons: debug
https://hacs-pyscript.readthedocs.io/en/latest/reference.html#logging
Okay so it's my bad, I had
logger:
default: warn
logs:
custom_components.pyscript: info
custom_components.pyscript.apps: debug
custom_components.pyscript.file: debug
Maybe it would be convenient for the new users to see a full logging setup example in the documentation. Something like
logger:
default: warn
logs:
custom_components.pyscript: info
custom_components.pyscript.apps: info
custom_components.pyscript.file: info
custom_components.pyscript.file.my_filename: debug
Thanks @ALERTua. As discussed in the thread, with the current decorators those lines are logged at debug through the logger of the script that defines the function, so they only show up if that path is set to debug. With legacy_decorators: true a different message (trigger ... got ... trigger, but not active) is logged under custom_components.pyscript.trigger instead.
The suggestion to document a full logging setup was added in https://github.com/custom-components/pyscript/pull/913. The "Logging" section of https://hacs-pyscript.readthedocs.io/en/latest/reference.html now has a table of logging paths for scripts, apps, modules and Jupyter. It says that Trigger not active due to ... is logged at debug under the script's own logger, and it gives a complete example with a quiet default, custom_components.pyscript: info, one app at info and one script at debug. I think this can be closed.