File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import (
27
27
"errors"
28
28
"fmt"
29
29
"io"
30
+ "log/slog"
30
31
"net"
31
32
"sync"
32
33
"time"
@@ -59,6 +60,7 @@ type Connection struct {
59
60
networkMagic uint32
60
61
server bool
61
62
useNodeToNodeProto bool
63
+ logger * slog.Logger
62
64
muxer * muxer.Muxer
63
65
errorChan chan error
64
66
protoErrorChan chan error
Original file line number Diff line number Diff line change 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.
15
15
package ouroboros
16
16
17
17
import (
18
+ "log/slog"
18
19
"net"
19
20
20
21
"github.com/blinklabs-io/gouroboros/protocol/blockfetch"
@@ -66,6 +67,13 @@ func WithServer(server bool) ConnectionOptionFunc {
66
67
}
67
68
}
68
69
70
+ // WithLogger specifies the slog.Logger to use. This is empty by default
71
+ func WithLogger (logger * slog.Logger ) ConnectionOptionFunc {
72
+ return func (c * Connection ) {
73
+ c .logger = logger
74
+ }
75
+ }
76
+
69
77
// WithNodeToNode specifies whether to use the node-to-node protocol. The default is to use node-to-client
70
78
func WithNodeToNode (nodeToNode bool ) ConnectionOptionFunc {
71
79
return func (c * Connection ) {
You can’t perform that action at this time.
0 commit comments