We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Go now has a nicer logging package in the standard library. It might be better to use that if the Go ecosystem is going to converge on that.
The text was updated successfully, but these errors were encountered:
Our current Logger is:
Logger
Logger interface { Println(v ...interface{}) Printf(format string, v ...interface{}) }
This is a subset of log.Logger so can be used with slog pretty easily:
log.Logger
slog
h := slog.NewJSONHandler(os.Stderr, &slog.HandlerOptions{Level: slog.LevelDebug}) cliCfg := autopaho.ClientConfig{ Errors: slog.NewLogLogger(h.WithAttrs([]slog.Attr{slog.String("source", "autoErrors")}), slog.LevelError), Debug: slog.NewLogLogger(h.WithAttrs([]slog.Attr{slog.String("source", "autoDebug")}), slog.LevelDebug), PahoErrors: slog.NewLogLogger(h.WithAttrs([]slog.Attr{slog.String("source", "pahoErrors")}), slog.LevelError), PahoDebug: slog.NewLogLogger(h.WithAttrs([]slog.Attr{slog.String("source", "pahoDebug")}), slog.LevelDebug), ...
Of course this does not enable the library itself to output structured messages.
Advantages of using slog:
Disadvantages of using slog:
I'm on the fence with this one; the above was really me trying to put my thoughts in order! Either way the logging could do with some work...
Sorry, something went wrong.
No branches or pull requests
Go now has a nicer logging package in the standard library. It might be better to use that if the Go ecosystem is going to converge on that.
The text was updated successfully, but these errors were encountered: