Commit c2b73c58 authored by protolambda's avatar protolambda

logging: clean up imports and log-util usage

parent 7a27f5d7
...@@ -127,10 +127,6 @@ func (s *l2VerifierBackend) SequencerActive(ctx context.Context) (bool, error) { ...@@ -127,10 +127,6 @@ func (s *l2VerifierBackend) SequencerActive(ctx context.Context) (bool, error) {
return false, nil return false, nil
} }
func (s *l2VerifierBackend) SetLogLevel(ctx context.Context, lvl string) error {
return nil
}
func (s *L2Verifier) L2Finalized() eth.L2BlockRef { func (s *L2Verifier) L2Finalized() eth.L2BlockRef {
return s.derivation.Finalized() return s.derivation.Finalized()
} }
......
...@@ -29,7 +29,6 @@ type driverClient interface { ...@@ -29,7 +29,6 @@ type driverClient interface {
StartSequencer(ctx context.Context, blockHash common.Hash) error StartSequencer(ctx context.Context, blockHash common.Hash) error
StopSequencer(context.Context) (common.Hash, error) StopSequencer(context.Context) (common.Hash, error)
SequencerActive(context.Context) (bool, error) SequencerActive(context.Context) (bool, error)
SetLogLevel(ctx context.Context, lvl string) error
} }
type rpcMetrics interface { type rpcMetrics interface {
......
...@@ -224,7 +224,3 @@ func (c *mockDriverClient) StopSequencer(ctx context.Context) (common.Hash, erro ...@@ -224,7 +224,3 @@ func (c *mockDriverClient) StopSequencer(ctx context.Context) (common.Hash, erro
func (c *mockDriverClient) SequencerActive(ctx context.Context) (bool, error) { func (c *mockDriverClient) SequencerActive(ctx context.Context) (bool, error) {
return c.Mock.MethodCalled("SequencerActive").Get(0).(bool), nil return c.Mock.MethodCalled("SequencerActive").Get(0).(bool), nil
} }
func (c *mockDriverClient) SetLogLevel(ctx context.Context, lvl string) error {
return c.Mock.MethodCalled("SetLogLevel").Get(0).(error)
}
...@@ -469,10 +469,6 @@ func (s *Driver) SequencerActive(ctx context.Context) (bool, error) { ...@@ -469,10 +469,6 @@ func (s *Driver) SequencerActive(ctx context.Context) (bool, error) {
} }
} }
func (s *Driver) SetLogLevel(ctx context.Context, lvl string) error {
return nil
}
// syncStatus returns the current sync status, and should only be called synchronously with // syncStatus returns the current sync status, and should only be called synchronously with
// the driver event loop to avoid retrieval of an inconsistent status. // the driver event loop to avoid retrieval of an inconsistent status.
func (s *Driver) syncStatus() *eth.SyncStatus { func (s *Driver) syncStatus() *eth.SyncStatus {
......
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/client" "github.com/ethereum-optimism/optimism/op-node/client"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
...@@ -59,6 +60,6 @@ func (r *RollupClient) SequencerActive(ctx context.Context) (bool, error) { ...@@ -59,6 +60,6 @@ func (r *RollupClient) SequencerActive(ctx context.Context) (bool, error) {
return result, err return result, err
} }
func (r *RollupClient) SetLogLevel(ctx context.Context, lvl string) error { func (r *RollupClient) SetLogLevel(ctx context.Context, lvl log.Lvl) error {
return r.rpc.CallContext(ctx, nil, "admin_setLogLevel", lvl) return r.rpc.CallContext(ctx, nil, "admin_setLogLevel", lvl.String())
} }
...@@ -45,7 +45,7 @@ func TestLogLevel(t *testing.T) { ...@@ -45,7 +45,7 @@ func TestLogLevel(t *testing.T) {
func TestLogFormat(t *testing.T) { func TestLogFormat(t *testing.T) {
t.Run("RejectInvalid", func(t *testing.T) { t.Run("RejectInvalid", func(t *testing.T) {
verifyArgsInvalid(t, "unrecognized log format: foo", addRequiredArgs("--log.format=foo")) verifyArgsInvalid(t, `unrecognized log-format: "foo"`, addRequiredArgs("--log.format=foo"))
}) })
for _, lvl := range []string{"json", "json-pretty", "terminal", "text", "logfmt"} { for _, lvl := range []string{"json", "json-pretty", "terminal", "text", "logfmt"} {
......
...@@ -5,7 +5,6 @@ import ( ...@@ -5,7 +5,6 @@ import (
"math/rand" "math/rand"
"testing" "testing"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
...@@ -20,6 +19,7 @@ import ( ...@@ -20,6 +19,7 @@ import (
"github.com/ethereum-optimism/optimism/op-program/client/mpt" "github.com/ethereum-optimism/optimism/op-program/client/mpt"
"github.com/ethereum-optimism/optimism/op-program/host/kvstore" "github.com/ethereum-optimism/optimism/op-program/host/kvstore"
"github.com/ethereum-optimism/optimism/op-service/eth" "github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/testlog"
) )
func TestNoHint(t *testing.T) { func TestNoHint(t *testing.T) {
......
...@@ -5,15 +5,17 @@ import ( ...@@ -5,15 +5,17 @@ import (
"errors" "errors"
"testing" "testing"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/testutils" "github.com/ethereum-optimism/optimism/op-node/testutils"
"github.com/ethereum-optimism/optimism/op-service/eth" "github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/retry" "github.com/ethereum-optimism/optimism/op-service/retry"
"github.com/ethereum-optimism/optimism/op-service/testlog" "github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
) )
func TestRetryingL1Source(t *testing.T) { func TestRetryingL1Source(t *testing.T) {
......
...@@ -121,7 +121,7 @@ func (fv *FormatFlagValue) Set(value string) error { ...@@ -121,7 +121,7 @@ func (fv *FormatFlagValue) Set(value string) error {
*fv = FormatFlagValue(value) *fv = FormatFlagValue(value)
return nil return nil
default: default:
return fmt.Errorf("unrecognized flag format: %q", value) return fmt.Errorf("unrecognized log-format: %q", value)
} }
} }
......
...@@ -5,9 +5,11 @@ import ( ...@@ -5,9 +5,11 @@ import (
"math/big" "math/big"
"testing" "testing"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/log"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-service/testlog"
) )
type priceBumpTest struct { type priceBumpTest struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment