log: use native log/slog instead of golang/exp (#29302)

This commit is contained in:
Martin HS 2024-03-22 13:17:59 +01:00 committed by GitHub
parent 6490d9897a
commit d9bde37ac3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 15 additions and 18 deletions

@ -18,6 +18,7 @@ package downloader
import ( import (
"fmt" "fmt"
"log/slog"
"math/big" "math/big"
"math/rand" "math/rand"
"os" "os"
@ -32,7 +33,6 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/trie"
"golang.org/x/exp/slog"
) )
// makeChain creates a chain of n blocks starting at and including parent. // makeChain creates a chain of n blocks starting at and including parent.

@ -24,6 +24,7 @@ import (
"bytes" "bytes"
"errors" "errors"
"io" "io"
"log/slog"
"os" "os"
"os/user" "os/user"
"path/filepath" "path/filepath"
@ -37,7 +38,6 @@ import (
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/hashicorp/go-bexpr" "github.com/hashicorp/go-bexpr"
"golang.org/x/exp/slog"
) )
// Handler is the global debugging handler. // Handler is the global debugging handler.

@ -19,6 +19,7 @@ package debug
import ( import (
"fmt" "fmt"
"io" "io"
"log/slog"
"net" "net"
"net/http" "net/http"
_ "net/http/pprof" _ "net/http/pprof"
@ -34,7 +35,6 @@ import (
"github.com/mattn/go-colorable" "github.com/mattn/go-colorable"
"github.com/mattn/go-isatty" "github.com/mattn/go-isatty"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"golang.org/x/exp/slog"
"gopkg.in/natefinch/lumberjack.v2" "gopkg.in/natefinch/lumberjack.v2"
) )

@ -21,11 +21,11 @@ import (
"bytes" "bytes"
"context" "context"
"fmt" "fmt"
"log/slog"
"sync" "sync"
"testing" "testing"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"golang.org/x/exp/slog"
) )
const ( const (

@ -3,6 +3,7 @@ package log
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"log/slog"
"math/big" "math/big"
"reflect" "reflect"
"strconv" "strconv"
@ -10,7 +11,6 @@ import (
"unicode/utf8" "unicode/utf8"
"github.com/holiman/uint256" "github.com/holiman/uint256"
"golang.org/x/exp/slog"
) )
const ( const (

@ -4,13 +4,13 @@ import (
"context" "context"
"fmt" "fmt"
"io" "io"
"log/slog"
"math/big" "math/big"
"reflect" "reflect"
"sync" "sync"
"time" "time"
"github.com/holiman/uint256" "github.com/holiman/uint256"
"golang.org/x/exp/slog"
) )
type discardHandler struct{} type discardHandler struct{}

@ -20,14 +20,13 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"log/slog"
"regexp" "regexp"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"sync/atomic" "sync/atomic"
"golang.org/x/exp/slog"
) )
// errVmoduleSyntax is returned when a user vmodule pattern is invalid. // errVmoduleSyntax is returned when a user vmodule pattern is invalid.

@ -2,12 +2,11 @@ package log
import ( import (
"context" "context"
"log/slog"
"math" "math"
"os" "os"
"runtime" "runtime"
"time" "time"
"golang.org/x/exp/slog"
) )
const errorKey = "LOG_ERROR" const errorKey = "LOG_ERROR"

@ -5,6 +5,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"log/slog"
"math/big" "math/big"
"os" "os"
"strings" "strings"
@ -12,7 +13,6 @@ import (
"time" "time"
"github.com/holiman/uint256" "github.com/holiman/uint256"
"golang.org/x/exp/slog"
) )
// TestLoggingWithVmodule checks that vmodule works. // TestLoggingWithVmodule checks that vmodule works.

@ -1,10 +1,9 @@
package log package log
import ( import (
"log/slog"
"os" "os"
"sync/atomic" "sync/atomic"
"golang.org/x/exp/slog"
) )
var root atomic.Value var root atomic.Value

@ -23,6 +23,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"log/slog"
"net" "net"
"net/http" "net/http"
"os" "os"
@ -41,7 +42,6 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"golang.org/x/exp/slog"
) )
func init() { func init() {

@ -21,6 +21,7 @@ import (
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"fmt" "fmt"
"log/slog"
"net" "net"
"os" "os"
"strconv" "strconv"
@ -34,7 +35,6 @@ import (
"github.com/ethereum/go-ethereum/p2p/enr" "github.com/ethereum/go-ethereum/p2p/enr"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
"golang.org/x/exp/slog"
) )
// Node represents a node in a simulation network which is created by a // Node represents a node in a simulation network which is created by a

@ -20,6 +20,7 @@ import (
"context" "context"
"flag" "flag"
"fmt" "fmt"
"log/slog"
"math/rand" "math/rand"
"net/http/httptest" "net/http/httptest"
"os" "os"
@ -37,7 +38,6 @@ import (
"github.com/ethereum/go-ethereum/p2p/simulations/adapters" "github.com/ethereum/go-ethereum/p2p/simulations/adapters"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
"github.com/mattn/go-colorable" "github.com/mattn/go-colorable"
"golang.org/x/exp/slog"
) )
func TestMain(m *testing.M) { func TestMain(m *testing.M) {

@ -19,6 +19,7 @@ package core
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"log/slog"
"os" "os"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -26,7 +27,6 @@ import (
"github.com/ethereum/go-ethereum/internal/ethapi" "github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/signer/core/apitypes" "github.com/ethereum/go-ethereum/signer/core/apitypes"
"golang.org/x/exp/slog"
) )
type AuditLogger struct { type AuditLogger struct {

@ -20,13 +20,13 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"log/slog"
"os" "os"
"testing" "testing"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/mattn/go-colorable" "github.com/mattn/go-colorable"
"golang.org/x/exp/slog"
) )
func TestEncryption(t *testing.T) { func TestEncryption(t *testing.T) {