Skip to content

Can't get logging to work #745

@drache42

Description

@drache42

I am just getting started with pyscript. I have it running, but logging doesn't seem to work.

in my configuration.yaml I have

logger:
  default: info
  logs:
    custom_components.pyscript: debug

My script file is this

@service
def hello(name: str = "world"):
    log.debug(f"[HELLO] entered hello(name={name!r})")

    light.toggle(entity_id="light.shelly_dimmer_master_sitting_room")

    msg = f"Hello, {name}!"
    log.info(f"[HELLO] {msg}")
    task.sleep(0.1)  # example of yielding; keeps HA responsive
    log.debug("[HELLO] leaving hello()")

I can run the script, and it toggles the light. This tells me the script can run and it works.

However, Going to Settings -> System -> Logs and looking at the Home Assistant Core log, I don't see any of my log messages. Logs from other things in my system are there, but nothing from my hello.py script.

Any help would be appreciated.

P.S. I've restarted HASS a few times, so that's not the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions