Skip to content

Commit

Permalink
chore: add logger
Browse files Browse the repository at this point in the history
  • Loading branch information
shanehull committed Sep 4, 2024
1 parent 143db20 commit 39ad6cb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,25 @@ var (
htmxHash = "sha384-Y7hw+L/jvKeWIRRkqWYfPcvVxHzVzn5REgzbawhxAuQGwX1XWe70vji+VSeHOThJ"
hyperscriptHash = "sha384-+Uth1QzYJsTjnS5SXVN3fFO4I32Y571xIuv53WJ2SA7y5/36tKU1VCutONAmg5eH"
echartsHash = "sha384-Mx5lkUEQPM1pOJCwFtUICyX45KNojXbkWdYhkKUKsbv391mavbfoAmONbzkgYPzR"
logger *slog.Logger
)

func init() {
logger = slog.New(
slog.NewJSONHandler(
os.Stdout, nil,
),
).With(slog.String("version", buildinfo.GitTag))
slog.SetDefault(logger)
}

func main() {
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
ctx, cancel := signal.NotifyContext(
context.Background(),
os.Interrupt,
syscall.SIGTERM,
)

fmt.Println("gitTag", buildinfo.GitTag)

// If the SERVER_HOST env var is set, use that
envHost, ok := os.LookupEnv("SERVER_HOST")
if ok {
Expand Down

0 comments on commit 39ad6cb

Please sign in to comment.