-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Consider replacing logging lib https://github.com/sirupsen/logrus with golang standard library log/slog as described in https://go.dev/blog/slog.
Indeed, github.com/sirupsen/logrus latest version is from june 2023, and it is not clear if it is still maintained.
Whereas log/slog is from go standard library (https://cs.opensource.google/go/go/+/master:src/log/slog/;bpv=1). We can expect more maintainance.
However, one drawback is the syntax from log/slog is different from github.com/sirupsen/logrus, because log/slog is structured:
import "github.com/sirupsen/logrus"
// ...
logrus.Infof("Loaded P11 PIN from file: %v", a)import "log/slog"
// ...
slog.Info("Loaded P11 PIN from file", slog.Any("pin", a))
// or
slog.Info("Loaded P11 PIN from file", "pin", a)The output should look like this:
2025/01/01 16:27:19 INFO Loaded P11 PIN from file pin=a.value
or depending on the log/slog output handler format of log/slog (text, JSON):
time=2025-01-01T16:56:03.786-04:00 level=INFO msg="hello, world" user=jba
Maybe this could be done at the same time than enhancing the CLI with a --log-level flag, like suggested in #47