Skip to content

Commit

Permalink
Combine noop init
Browse files Browse the repository at this point in the history
  • Loading branch information
zivkovicmilos committed Mar 7, 2024
1 parent 0981aec commit 28379aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ type Faucet struct {
sendAmount std.Coins // for fast lookup
}

var noopLogger = slog.New(slog.NewTextHandler(io.Discard, nil))

// NewFaucet creates a new instance of the Gno faucet server
func NewFaucet(
estimator estimate.Estimator,
Expand All @@ -47,7 +49,7 @@ func NewFaucet(
f := &Faucet{
estimator: estimator,
client: client,
logger: slog.New(slog.NewTextHandler(io.Discard, nil)),
logger: noopLogger,
config: config.DefaultConfig(),
prepareTxMsgFn: defaultPrepareTxMessage,
middlewares: nil, // no middlewares by default
Expand Down
4 changes: 1 addition & 3 deletions faucet_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package faucet

import (
"io"
"log/slog"
"net/http"
"testing"

Expand Down Expand Up @@ -136,7 +134,7 @@ func TestFaucet_NewFaucet(t *testing.T) {
&mockEstimator{},
&mockClient{},
WithConfig(config.DefaultConfig()),
WithLogger(slog.New(slog.NewTextHandler(io.Discard, nil))),
WithLogger(noopLogger),
)

assert.NotNil(t, f)
Expand Down

0 comments on commit 28379aa

Please sign in to comment.