Add structured logging with log/slog
Replace fmt.Printf logging calls with slog.Info/slog.Error for structured JSON output to stderr. Add internal/log package to initialize the default slog handler from the config log level. Fix .gitignore to only ignore the binary at the repo root, not the cmd/eng-pad-server directory. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
|
||||
pb "git.wntrmute.dev/kyle/eng-pad-server/gen/engpad/v1"
|
||||
@@ -46,7 +47,7 @@ func Start(cfg Config) (*grpc.Server, error) {
|
||||
syncSvc := &SyncService{DB: cfg.DB, BaseURL: cfg.BaseURL}
|
||||
pb.RegisterEngPadSyncServer(srv, syncSvc)
|
||||
|
||||
fmt.Printf("gRPC listening on %s\n", cfg.Addr)
|
||||
slog.Info("gRPC server started", "addr", cfg.Addr)
|
||||
go func() { _ = srv.Serve(lis) }()
|
||||
|
||||
return srv, nil
|
||||
|
||||
Reference in New Issue
Block a user