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

Replaced log with slog, added debug levels and an option to have semi… #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jonmol
Copy link

@jonmol jonmol commented Jun 16, 2024

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

…-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
@erkexzcx
Copy link
Owner

Hi. I will review this once I have some free time. Thank you!

@erkexzcx erkexzcx self-assigned this Jul 19, 2024
@erkexzcx
Copy link
Owner

Impressive work. You fixed many "invisible" issues. I'll do some tests on my end and merge this. Meanwhile, I am considering doing some automated tests for this application... 🤔

@erkexzcx
Copy link
Owner

The new log/slog package in Go 1.21 brings structured logging to the standard library.

I wasn't following Golang for a while, yet been developing in Golang 😅. That's really really neat! Thank you!

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.

None yet

2 participants