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

chore: switch to slog for logging #253

Merged
merged 1 commit into from
Sep 24, 2024
Merged

chore: switch to slog for logging #253

merged 1 commit into from
Sep 24, 2024

Conversation

verbotenj
Copy link
Contributor

Fixes #152

{"timestamp":"2024-09-23T19:34:48-04:00","level":"INFO","msg":"","component":"main","plugin":"output.log","type":"event","event":{"type":"chainsync.rollback","timestamp":"2024-09-23T19:34:48.355378-04:00","payload":{"blockHash":"a5363bdbde9888a367f36dbbb0b2d2610c41f3dcd416ce69aa448520744f7294","slotNumber":60478482}}}
{"timestamp":"2024-09-23T19:34:53-04:00","level":"INFO","msg":"","component":"main","plugin":"output.log","type":"event","event":{"type":"chainsync.block","timestamp":"2024-09-23T19:34:53.418663-04:00","context":{"blockNumber":2512374,"slotNumber":60478493,"networkMagic":0},"payload":{"blockBodySize":4,"issuerVkey":"6080b9c76b4b19c21d17b4091aa205417cb80a5449f638c27eec0946","blockHash":"8b49d800f735f420ce67997981f8f1ae76105caa75593bc1a0ac118ec7fbd9a3","transactionCount":0}}}

@verbotenj verbotenj requested a review from a team as a code owner September 23, 2024 23:35
api/api_test.go Outdated
@@ -20,13 +21,15 @@ func TestRouteRegistration(t *testing.T) {
if registrar, ok := interface{}(pushPlugin).(api.APIRouteRegistrar); ok {
registrar.RegisterRoutes()
} else {
t.Fatal("pushPlugin does NOT implement APIRouteRegistrar")
t.Error("pushPlugin does NOT implement APIRouteRegistrar")
os.Exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave this as it was. It's not related to slog, and there's no reason to change it.

api/api_test.go Outdated
}

// Create a test request to one of the registered routes
req, err := http.NewRequest(http.MethodGet, "/v1/fcm/someToken", nil)
if err != nil {
t.Fatal(err)
t.Error(err)
os.Exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave this as it was. It's not related to slog, and there's no reason to change it.


// Start debug listener
if cfg.Debug.ListenPort > 0 {
logger.Infof(
logger.Info(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs an inner fmt.Sprintf()

Signed-off-by: Ales Verbic <verbotenj@blinklabs.io>
@verbotenj verbotenj merged commit 4604e48 into main Sep 24, 2024
9 checks passed
@verbotenj verbotenj deleted the chore/change-to-slog branch September 24, 2024 01:48
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.

Switch to slog interface for plugin logging
2 participants