Skip to content

Commit 28379aa

Browse files
committed
Combine noop init
1 parent 0981aec commit 28379aa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

faucet.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ type Faucet struct {
3838
sendAmount std.Coins // for fast lookup
3939
}
4040

41+
var noopLogger = slog.New(slog.NewTextHandler(io.Discard, nil))
42+
4143
// NewFaucet creates a new instance of the Gno faucet server
4244
func NewFaucet(
4345
estimator estimate.Estimator,
@@ -47,7 +49,7 @@ func NewFaucet(
4749
f := &Faucet{
4850
estimator: estimator,
4951
client: client,
50-
logger: slog.New(slog.NewTextHandler(io.Discard, nil)),
52+
logger: noopLogger,
5153
config: config.DefaultConfig(),
5254
prepareTxMsgFn: defaultPrepareTxMessage,
5355
middlewares: nil, // no middlewares by default

faucet_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package faucet
22

33
import (
4-
"io"
5-
"log/slog"
64
"net/http"
75
"testing"
86

@@ -136,7 +134,7 @@ func TestFaucet_NewFaucet(t *testing.T) {
136134
&mockEstimator{},
137135
&mockClient{},
138136
WithConfig(config.DefaultConfig()),
139-
WithLogger(slog.New(slog.NewTextHandler(io.Discard, nil))),
137+
WithLogger(noopLogger),
140138
)
141139

142140
assert.NotNil(t, f)

0 commit comments

Comments
 (0)