1
- // Copyright 2023 Blink Labs Software
1
+ // Copyright 2024 Blink Labs Software
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
@@ -16,10 +16,11 @@ package main
16
16
17
17
import (
18
18
"fmt"
19
+ "log/slog"
19
20
"net/http"
20
21
"os"
21
22
22
- _ "go.uber.org/automaxprocs"
23
+ "go.uber.org/automaxprocs/maxprocs "
23
24
24
25
"github.com/blinklabs-io/adder/api"
25
26
_ "github.com/blinklabs-io/adder/filter"
@@ -36,6 +37,10 @@ const (
36
37
programName = "adder"
37
38
)
38
39
40
+ func slogPrintf (format string , v ... any ) {
41
+ slog .Info (fmt .Sprintf (format , v ... ))
42
+ }
43
+
39
44
func main () {
40
45
cfg := config .GetConfig ()
41
46
@@ -86,6 +91,15 @@ func main() {
86
91
// Configure logging
87
92
logging .Configure ()
88
93
logger := logging .GetLogger ()
94
+ slog .SetDefault (logger )
95
+
96
+ // Configure max processes with our logger wrapper, toss undo func
97
+ _ , err := maxprocs .Set (maxprocs .Logger (slogPrintf ))
98
+ if err != nil {
99
+ // If we hit this, something really wrong happened
100
+ logger .Error (err .Error ())
101
+ os .Exit (1 )
102
+ }
89
103
90
104
// Start debug listener
91
105
if cfg .Debug .ListenPort > 0 {
0 commit comments