Replaced log with slog, added debug levels and an option to have semi… #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First off: Sorry for the massive PR. My intention was just to add a new endpoint spitting out some sane starter config for lovelace-xiaomi-vacuum-map-card as I was struggling with that. I ended up making some pretty large changes, hopefully adding a bit of stability while sticking to the code style of the repo. It should be relatively easy to cherry pick if you just want the new endpoint.
Replaced log with slog, added debug levels and an option to have semi-structured logs in json
Added graceful shutdown for MQTT and HTTP, just letting the main process die might lead to http not releasing the port
Changed the connection to MQTT a bit and added waitgroups for the go routines
The for loop in server.go was blocking so the function never listened for signals to shut down
Added a new debug endpoint which prints out a semi-decent configuration for lovelace-xiaomi-vacuum-map-card