Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions cmd/adder/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Blink Labs Software
// Copyright 2024 Blink Labs Software
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -16,10 +16,11 @@ package main

import (
"fmt"
"log/slog"
"net/http"
"os"

_ "go.uber.org/automaxprocs"
"go.uber.org/automaxprocs/maxprocs"

"github.com/blinklabs-io/adder/api"
_ "github.com/blinklabs-io/adder/filter"
Expand All @@ -36,6 +37,10 @@ const (
programName = "adder"
)

func slogPrintf(format string, v ...any) {
slog.Info(fmt.Sprintf(format, v...))
}

func main() {
cfg := config.GetConfig()

Expand Down Expand Up @@ -86,6 +91,15 @@ func main() {
// Configure logging
logging.Configure()
logger := logging.GetLogger()
slog.SetDefault(logger)

// Configure max processes with our logger wrapper, toss undo func
_, err := maxprocs.Set(maxprocs.Logger(slogPrintf))
if err != nil {
// If we hit this, something really wrong happened
logger.Error(err.Error())
os.Exit(1)
}

// Start debug listener
if cfg.Debug.ListenPort > 0 {
Expand Down