Migrate from zerolog to slog (#248)

* Begin adding new slog calls

* Fixed unit tests

* Add leveler example

* Add debug log level to Redis example

* Change location of server.Close() and add logs to example/hooks

* Begin removing references to zerolog

* Removed final references to zerolog

* Change where server.Close() occurs in main

* Change to 1.21 to remove x dependency

* Add slog

* Update references to 1.21

* Begin change of LogAttrs to standard logging interface

* Change the rest of LogAttrs to default

* Fix bad log

* Update badger.go

Changing "data" to "key" or "id" here might be more appropriate.

* Update badger.go

Changing "data" to "key" or "id" here might be more appropriate.

* Update server.go

Not checking if err is equal to nil

* Update server.go

printing information for ID or error is missing.

* Change references of err.Error() to err in slog

* Remove missed removal of Error() references for logging

---------

Co-authored-by: Derek Duncan <dduncan@atlassian.com>
Co-authored-by: Derek Duncan <derekduncan@gmail.com>
Co-authored-by: JB <28275108+mochi-co@users.noreply.github.com>
Co-authored-by: werbenhu <werben@qq.com>
This commit is contained in:
Derek Duncan
2023-09-06 09:21:04 -05:00
committed by GitHub
parent e784c755ae
commit 44bac0adc5
100 changed files with 561 additions and 8569 deletions

View File

@@ -10,7 +10,7 @@ import (
"os/signal"
"syscall"
"github.com/mochi-mqtt/server/v2"
mqtt "github.com/mochi-mqtt/server/v2"
"github.com/mochi-mqtt/server/v2/hooks/auth"
"github.com/mochi-mqtt/server/v2/listeners"
)
@@ -77,7 +77,7 @@ func main() {
}()
<-done
server.Log.Warn().Msg("caught signal, stopping...")
server.Log.Warn("caught signal, stopping...")
server.Close()
server.Log.Info().Msg("main.go finished")
server.Log.Info("main.go finished")
}