Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Clean up debug prints #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jdanders
Copy link
Contributor

@jdanders jdanders commented Feb 6, 2025

Update json to print in easy to read format, adjust large json debug to write to file instead of print (and gitignore json files)

@jdanders jdanders changed the title Clean up debug prints refactor: Clean up debug prints Feb 6, 2025
.gitignore Outdated
@@ -90,3 +90,5 @@ ENV/

# IDE
.idea/

*.json
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should add this. If we add more example equipment responses in the future is going to just make it harder to get them added in the commits.

_LOGGER.debug(_json)
if _LOGGER.getEffectiveLevel() == logging.DEBUG:
_LOGGER.debug("Logging json to locations_debug.json")
with open('locations_debug.json', 'w') as debug_file:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this library is used in Home Assistant where will this file be written? Seems like it will result in making it more difficult to get logs from users.

Update json to print in easy to read format, adjust large json debug to write to file instead of print (and gitignore json files)
@jdanders
Copy link
Contributor Author

jdanders commented Feb 8, 2025

Good feedback, I was not considering HA logging. Does the formatted json printing work in HA? I'll see if I can check

@w1ll1am23
Copy link
Owner

Not sure I'd assume it would but maybe not?

@jdanders
Copy link
Contributor Author

jdanders commented Feb 8, 2025

Looks good in the txt format logs. The web GUI logs just munges it back together again into one line.

@jdanders
Copy link
Contributor Author

jdanders commented Feb 9, 2025

Updated to change error message to debug on econet errors

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.

2 participants