stianaske / pybotvac

Python module for interacting with Neato Botvac Connected vacuum robots.
MIT License
84 stars 44 forks source link

Use logger instead of print #54

Closed Santobert closed 3 years ago

Santobert commented 4 years ago

I've replaced that print call with a logging.warning statement. Please reject this PR if this is unwanted. :slightly_smiling_face:

dshokouhi commented 4 years ago

Will this allow HA to display the error?

Santobert commented 4 years ago

Will this allow HA to display the error?

Depending on their configuration. I haven't tested it yet. I changed this mainly because I think it's good practice to use logging instead of printing.

stianaske commented 4 years ago

I agree that logging is preferred to printing, but I guess we should do some testing with HA before merging this to avoid introducing potentially breaking changes before the HA update?

Santobert commented 4 years ago
2019-10-19 20:56:11 INFO (MainThread) [homeassistant.components.mailbox] Setting up mailbox.demo
2019-10-19 20:56:11 INFO (MainThread) [homeassistant.components.switch] Setting up switch.demo
2019-10-19 20:56:11 INFO (MainThread) [homeassistant.components.light] Setting up light.demo
2019-10-19 20:56:11 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.legacy
2019-10-19 20:56:13 WARNING (SyncWorker_1) [pybotvac.account] Your robot Sally is offline.
2019-10-19 20:56:14 WARNING (SyncWorker_1) [pybotvac.account] Your robot Sally is offline.
2019-10-19 20:56:14 INFO (MainThread) [homeassistant.components.switch] Setting up switch.neato
2019-10-19 20:56:14 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.neato
2019-10-19 20:56:14 INFO (SyncWorker_4) [homeassistant.loader] Loaded vacuum from homeassistant.components.vacuum
2019-10-19 20:56:14 INFO (MainThread) [homeassistant.setup] Setting up vacuum
2019-10-19 20:56:14 INFO (MainThread) [homeassistant.setup] Setup of domain vacuum took 0.0 seconds.
2019-10-19 20:56:14 INFO (MainThread) [homeassistant.components.vacuum] Setting up vacuum.neato
2019-10-19 20:56:17 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 6.49s
2019-10-19 20:56:17 INFO (MainThread) [homeassistant.core] Starting Home Assistant

This didn't break anything. Instead of the raw print a log message is now displayed.

dshokouhi commented 4 years ago

That is much better!