-
Notifications
You must be signed in to change notification settings - Fork 137
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
replace ipfs/go-log with stdlib log/slog #856
Conversation
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.
truely god's work 🫡
@@ -292,6 +294,8 @@ func runBigsky(cctx *cli.Context) error { | |||
signals := make(chan os.Signal, 1) | |||
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM) | |||
|
|||
// TODO: set slog default from param/env |
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 think this will be an unexpected degradation from current config, so I would recommend setting this up for relay (bigsky) specifically. There is some example code in palomar
's main.go
.
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 have a second PR coming with this
@@ -486,7 +490,8 @@ func runBigsky(cctx *cli.Context) error { | |||
// set up metrics endpoint | |||
go func() { | |||
if err := bgs.StartMetrics(cctx.String("metrics-listen")); err != nil { | |||
log.Fatalf("failed to start metrics endpoint: %s", err) | |||
log.Error("failed to start metrics endpoint", "err", err) | |||
os.Exit(1) |
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.
any style reason to use Exit(1)
vs Exit(-1)
? I to the later by default but don't super care either way.
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 checked the source for stdlib log.Fatal and it's Exit(1)
@@ -79,6 +79,9 @@ func run(args []string) { | |||
EnvVars: []string{"ATP_PLC_HOST"}, | |||
}, | |||
} | |||
|
|||
// TODO: slog.SetDefault from param/env |
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.
way less important for gosky
vs relay, IMO, though @whyrusleeping might care? might be helpful for some debug stuff
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 have a second PR coming with this, at least for relay
// HandleRepoStream | ||
// con is source of events | ||
// sched gets AddWork for each event | ||
// log may be nil for default logger |
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.
🤌
"gorm.io/driver/sqlite" | ||
"gorm.io/gorm" | ||
) | ||
|
||
func init() { | ||
logging.SetAllLoggers(logging.LevelDebug) |
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 think there is a way to call slog.SetDefaultLogger
, just to know that, but don't need to do it here and now
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.
a little extra util code should set the logger at something that writes to testing.T.Log()
chaser: integrate with main()s to set log file path, rotation rules, log level from env vars |
7613d5e
to
2c705ee
Compare
No description provided.