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 of all thank you so much for doing and sharing this MQTT 5 Server. 🙏
At least in my initial searches, this was the only result of a Go(lang) based MQTT 5 Server.
And I'm planning to contribute to it in my following weeks and months.
I know it might be just a picky thing and maybe I'm used to see stack traces when something really bad or unknown happened (in which case a stack trace that should bring enough context details).
When I tested initially with a
paho.golag
client (which works just fine, btw, at least for now), in case of an authentication failure (either user doesn't exist or client provide wrong user credentials), the server (gmqttd
) logs the error but also the stack trace. And that's defined on purpose inconfig/config.go:237
) by:zaplog := zap.New(core, zap.AddStacktrace(zap.ErrorLevel), zap.AddCaller())
Since to me it looks like something really bad happened.
And that's why I'm proposing this small change for now: a connection lost should be logged as warning.
Later, I would include one additional logging config item to specify at which level you'd like to have the stack trace included.