-
Notifications
You must be signed in to change notification settings - Fork 58
Cant Get Log.<Level>() Func to work #562
-
Syntax errors in Python Scripts get logged; but manually calling log.() in a script doesn't appear to work at all.
( I can put this as an issue if needed, but I'm hoping I've just dun-goofed and someone can tell me what ive done wrong)
Home Assistant: Core 2023年12月4日
pyscript: [1.5.0]
(Jupyter not installed)
Configuration.yaml includes
logger:
default: debug
logs:
custom_components.pyscript: debug
peanut.py has the following code (yes, I have tried it in explicitly putting the log level for the script in Configuration.yaml)
@service(supports_response="optional")
def loggingTest():
logger.set_level(**{"custom_components.pyscript.file.peanut.loggingTest": "debug"})
log.debug("test1")
return {"Complete": True}
Beta Was this translation helpful? Give feedback.
All reactions
First, I'm not sure whether the web logs display is the same as the HASS log file. Can anyone confirm that?
Next, I'd like to confirm that you don't see log.debug()
messages when you specify:
logger: default: debug logs: custom_components.pyscript: debug
Did you restart HASS after updating the yaml file?
The dynamic setting in the function creates a race condition. Since it's implemented as a service call, the log.debug()
immediately following won't appear since the service call is unlikely to have been executed yet. I should add that to the documentation....
Replies: 1 comment 1 reply
-
First, I'm not sure whether the web logs display is the same as the HASS log file. Can anyone confirm that?
Next, I'd like to confirm that you don't see log.debug()
messages when you specify:
logger: default: debug logs: custom_components.pyscript: debug
Did you restart HASS after updating the yaml file?
The dynamic setting in the function creates a race condition. Since it's implemented as a service call, the log.debug()
immediately following won't appear since the service call is unlikely to have been executed yet. I should add that to the documentation....
Beta Was this translation helpful? Give feedback.
All reactions
-
I did some checking and confirm it gets logged to the home-assistant.log file
Beta Was this translation helpful? Give feedback.