-
Notifications
You must be signed in to change notification settings - Fork 217
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
[shell-operator] Replace Logrus with slog #671
Conversation
6c5e494
to
8020163
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to define an interface at the shell-operator level (currently it is here https://github.com/flant/addon-operator/blob/main/pkg/utils/logger/logger.go) but with the following changes:
-
mark all *f and *ln methods as deprecated. *ln because Println in the logger does nothing different from Print and simply inflates the interface for no reason, and *f methods should not be called in the structured logger, all arguments should be passed as slog.Attr. (or key-value pairs, but we are not using this now, see below). Otherwise, we will have a situation like now, when all non-primitive types are first converted to a string by the fmt package, and then also encoded with json, the consequences of which we see every day on environments.
-
Considering that slog.Info perceives arguments as key-value pairs, we cannot use it directly in this interface, so at this stage I propose to create only With, WithGroup, FatalAttrs, PanicAttrs, DebugAttrs, ErrorAttrs, InfoAttrs, WarnAttrs, leaving the slog.Logger methods that accept key-value pairs in the form of []any until better times.
|
9577036
to
e37695d
Compare
Signed-off-by: Pavel Okhlopkov <[email protected]>
96033b8
to
46fdab9
Compare
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
47bcf50
to
20b7682
Compare
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
3ade75e
to
2db6c5a
Compare
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Signed-off-by: Pavel Okhlopkov <[email protected]>
Overview
Replace Logrus to Slog implementation
What this PR does / why we need it
We can freely remove Logrus. That's the point!
Special notes for your reviewer
For testing purpose deckhouse/deckhouse#10209