File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import (
16
16
"time"
17
17
18
18
"github.com/prometheus/client_golang/prometheus/promhttp"
19
- _ "go.uber.org/automaxprocs"
19
+ "go.uber.org/automaxprocs/maxprocs "
20
20
21
21
"github.com/blinklabs-io/cdnsd/internal/config"
22
22
"github.com/blinklabs-io/cdnsd/internal/dns"
@@ -30,6 +30,10 @@ var cmdlineFlags struct {
30
30
configFile string
31
31
}
32
32
33
+ func slogPrintf (format string , v ... any ) {
34
+ slog .Info (fmt .Sprintf (format , v ... ))
35
+ }
36
+
33
37
func main () {
34
38
flag .StringVar (
35
39
& cmdlineFlags .configFile ,
@@ -46,9 +50,19 @@ func main() {
46
50
os .Exit (1 )
47
51
}
48
52
53
+ // Configure logger
54
+ logging .Configure ()
49
55
logger := logging .GetLogger ()
50
56
slog .SetDefault (logger )
51
57
58
+ // Configure max processes with our logger wrapper, toss undo func
59
+ _ , err = maxprocs .Set (maxprocs .Logger (slogPrintf ))
60
+ if err != nil {
61
+ // If we hit this, something really wrong happened
62
+ logger .Error (err .Error ())
63
+ os .Exit (1 )
64
+ }
65
+
52
66
slog .Info (
53
67
fmt .Sprintf ("cdnsd %s started" , version .GetVersionString ()),
54
68
)
You can’t perform that action at this time.
0 commit comments