Skip to content

Commit

Permalink
log: use native log/slog instead of golang/exp (#29302)
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Mar 22, 2024
1 parent 6490d98 commit d9bde37
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion eth/downloader/queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package downloader

import (
"fmt"
"log/slog"
"math/big"
"math/rand"
"os"
Expand All @@ -32,7 +33,6 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
"golang.org/x/exp/slog"
)

// makeChain creates a chain of n blocks starting at and including parent.
Expand Down
2 changes: 1 addition & 1 deletion internal/debug/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"bytes"
"errors"
"io"
"log/slog"
"os"
"os/user"
"path/filepath"
Expand All @@ -37,7 +38,6 @@ import (

"github.com/ethereum/go-ethereum/log"
"github.com/hashicorp/go-bexpr"
"golang.org/x/exp/slog"
)

// Handler is the global debugging handler.
Expand Down
2 changes: 1 addition & 1 deletion internal/debug/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package debug
import (
"fmt"
"io"
"log/slog"
"net"
"net/http"
_ "net/http/pprof"
Expand All @@ -34,7 +35,6 @@ import (
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
"github.com/urfave/cli/v2"
"golang.org/x/exp/slog"
"gopkg.in/natefinch/lumberjack.v2"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/testlog/testlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"bytes"
"context"
"fmt"
"log/slog"
"sync"
"testing"

"github.com/ethereum/go-ethereum/log"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion log/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package log
import (
"bytes"
"fmt"
"log/slog"
"math/big"
"reflect"
"strconv"
"time"
"unicode/utf8"

"github.com/holiman/uint256"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion log/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"context"
"fmt"
"io"
"log/slog"
"math/big"
"reflect"
"sync"
"time"

"github.com/holiman/uint256"
"golang.org/x/exp/slog"
)

type discardHandler struct{}
Expand Down
3 changes: 1 addition & 2 deletions log/handler_glog.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"regexp"
"runtime"
"strconv"
"strings"
"sync"
"sync/atomic"

"golang.org/x/exp/slog"
)

// errVmoduleSyntax is returned when a user vmodule pattern is invalid.
Expand Down
3 changes: 1 addition & 2 deletions log/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package log

import (
"context"
"log/slog"
"math"
"os"
"runtime"
"time"

"golang.org/x/exp/slog"
)

const errorKey = "LOG_ERROR"
Expand Down
2 changes: 1 addition & 1 deletion log/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"errors"
"fmt"
"io"
"log/slog"
"math/big"
"os"
"strings"
"testing"
"time"

"github.com/holiman/uint256"
"golang.org/x/exp/slog"
)

// TestLoggingWithVmodule checks that vmodule works.
Expand Down
3 changes: 1 addition & 2 deletions log/root.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package log

import (
"log/slog"
"os"
"sync/atomic"

"golang.org/x/exp/slog"
)

var root atomic.Value
Expand Down
2 changes: 1 addition & 1 deletion p2p/simulations/adapters/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"io"
"log/slog"
"net"
"net/http"
"os"
Expand All @@ -41,7 +42,6 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/rpc"
"github.com/gorilla/websocket"
"golang.org/x/exp/slog"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion p2p/simulations/adapters/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"log/slog"
"net"
"os"
"strconv"
Expand All @@ -34,7 +35,6 @@ import (
"github.com/ethereum/go-ethereum/p2p/enr"
"github.com/ethereum/go-ethereum/rpc"
"github.com/gorilla/websocket"
"golang.org/x/exp/slog"
)

// Node represents a node in a simulation network which is created by a
Expand Down
2 changes: 1 addition & 1 deletion p2p/simulations/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"flag"
"fmt"
"log/slog"
"math/rand"
"net/http/httptest"
"os"
Expand All @@ -37,7 +38,6 @@ import (
"github.com/ethereum/go-ethereum/p2p/simulations/adapters"
"github.com/ethereum/go-ethereum/rpc"
"github.com/mattn/go-colorable"
"golang.org/x/exp/slog"
)

func TestMain(m *testing.M) {
Expand Down
2 changes: 1 addition & 1 deletion signer/core/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ package core
import (
"context"
"encoding/json"
"log/slog"
"os"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/signer/core/apitypes"
"golang.org/x/exp/slog"
)

type AuditLogger struct {
Expand Down
2 changes: 1 addition & 1 deletion signer/storage/aes_gcm_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (
"bytes"
"encoding/json"
"fmt"
"log/slog"
"os"
"testing"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/mattn/go-colorable"
"golang.org/x/exp/slog"
)

func TestEncryption(t *testing.T) {
Expand Down

0 comments on commit d9bde37

Please sign in to comment.