Skip to content

optional logging - level and custom handler - #16

Merged
tfriedel merged 11 commits into
tfriedel:masterfrom
rbdubz3:master
Feb 10, 2019
Merged

tfriedel merged 11 commits into
tfriedel:masterfrom
rbdubz3:master

Conversation

@rbdubz3

@rbdubz3 rbdubz3 commented Feb 6, 2019

Copy link
Copy Markdown

added optional logging features:

  • pass level into constructor
  • pass custom handler into constructor
  • add method to manipulate log level at runtime

Comment thread lightify/__init__.py Resolved
@rbdubz3

rbdubz3 commented Feb 6, 2019

Copy link
Copy Markdown
Author

sorry guys - GitHub neophyte - noticed another consistency change but not sure how to get the PR to pull the latest from my fork master .. I basically changed the actual param names 'log_level' to match in both constructor and set_loglevel method

@OleksandrBerchenko

Copy link
Copy Markdown

See https://github.com/tfriedel/python-lightify/pull/16/files - it looks like you have changed that successfully. Does it display all your changes?

Thanks!

@rbdubz3

rbdubz3 commented Feb 6, 2019

Copy link
Copy Markdown
Author

@OleksandrBerchenko - yeah those look good .. think we are clean and consistent now with comments - thanks

@OleksandrBerchenko

Copy link
Copy Markdown

@tfriedel Hi! Are you waiting for me to test it with Home Assistant logger, or am I waiting when it's merged first? :)

@rbdubz3

rbdubz3 commented Feb 10, 2019

Copy link
Copy Markdown
Author

@OleksandrBerchenko - curious on the support for 'scenes' - is there any way to invoke the built-in dynamic scenes from the Sylvania mobile app using the python library - Fireplace, Ocean, Candy, Polar Light, etc ?

@OleksandrBerchenko

Copy link
Copy Markdown

@rbdubz3 I don't know, sorry.

@tfriedel
tfriedel merged commit 08c5876 into tfriedel:master Feb 10, 2019
@tfriedel

Copy link
Copy Markdown
Owner

@OleksandrBerchenko I merged it now. Can you please test it with the HA logger?

@OleksandrBerchenko

Copy link
Copy Markdown

1. In general, you don't need to pass HA log handler into Lightify class to control the logging. Everything already works as expected. For example, you may have in configuration.yaml:

logger:
  default: info
  logs:
    lightify: warning

2. The only issue is that you can't set a less severe level than the one from Lightify:

self.__logger.setLevel(log_level)

In other words, if by default you have log_level=logging.INFO, you can't set it to DEBUG in configuration.yaml. I have already fixed that in osramlightify.py by passing logging.DEBUG into Lightify constructor (using the new code from @rbdubz3). See https://github.com/OleksandrBerchenko/home-assistant/blob/osramlightify/homeassistant/components/light/osramlightify.py. So, now any level set in configuration.yaml will work as expected.

P.S. @tfriedel Let me know when you had a chance to go through my comments in #13.

When we finalize all the changes, you will need to trigger a new build on Pypi.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants