Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cant Get Log.<Level>() Func to work #562

Discussion options

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}

image

image

You must be logged in to vote

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

Comment options

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....

You must be logged in to vote
1 reply
Comment options

I did some checking and confirm it gets logged to the home-assistant.log file

Answer selected by ALEXTHENINJA007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /