Skip to content
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

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

brianolson
Copy link
Contributor

No description provided.

Copy link
Collaborator

@bnewbold bnewbold left a 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
Copy link
Collaborator

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.

Copy link
Contributor Author

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)
Copy link
Collaborator

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.

Copy link
Contributor Author

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
Copy link
Collaborator

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

Copy link
Contributor Author

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
Copy link
Collaborator

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)
Copy link
Collaborator

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

Copy link
Contributor Author

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()

@brianolson
Copy link
Contributor Author

chaser: integrate with main()s to set log file path, rotation rules, log level from env vars
brianolson#2

@brianolson brianolson merged commit a5a00fc into bluesky-social:main Dec 5, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants