mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
log: use native log/slog instead of golang/exp (#29302)
This commit is contained in:
parent
40fd68a124
commit
946c085f9f
11 changed files with 13 additions and 16 deletions
|
|
@ -23,6 +23,7 @@ package debug
|
|||
import (
|
||||
"errors"
|
||||
"io"
|
||||
"log/slog"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
|
|
@ -35,7 +36,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/log"
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
// Handler is the global debugging handler.
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package debug
|
|||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
"os"
|
||||
|
|
@ -30,7 +31,6 @@ import (
|
|||
"github.com/XinFinOrg/XDPoSChain/metrics/exp"
|
||||
"github.com/mattn/go-colorable"
|
||||
"github.com/mattn/go-isatty"
|
||||
"golang.org/x/exp/slog"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
"gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/log"
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package log
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"math/big"
|
||||
"reflect"
|
||||
"strconv"
|
||||
|
|
@ -10,7 +11,6 @@ import (
|
|||
"unicode/utf8"
|
||||
|
||||
"github.com/holiman/uint256"
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -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{}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -2,12 +2,11 @@ package log
|
|||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"math"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
const errorKey = "LOG_ERROR"
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"math/big"
|
||||
"os"
|
||||
"strings"
|
||||
|
|
@ -12,7 +13,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/holiman/uint256"
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
// TestLoggingWithVmodule checks that vmodule works.
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@ package log
|
|||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
var root atomic.Value
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log/slog"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
|
@ -42,7 +43,6 @@ import (
|
|||
"github.com/XinFinOrg/XDPoSChain/rpc"
|
||||
"github.com/docker/docker/pkg/reexec"
|
||||
"github.com/gorilla/websocket"
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
// ExecAdapter is a NodeAdapter which runs simulation nodes by executing the
|
||||
|
|
@ -384,7 +384,7 @@ func initLogging() {
|
|||
// and the node config from an environment variable.
|
||||
func execP2PNode() {
|
||||
initLogging()
|
||||
|
||||
|
||||
// read the services from argv
|
||||
serviceNames := strings.Split(os.Args[1], ",")
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ func execP2PNode() {
|
|||
}
|
||||
var conf execNodeConfig
|
||||
if err := json.Unmarshal([]byte(confEnv), &conf); err != nil {
|
||||
log.Crit("error decoding " + envNodeConfig, "err", err)
|
||||
log.Crit("error decoding "+envNodeConfig, "err", err)
|
||||
}
|
||||
conf.Stack.P2P.PrivateKey = conf.Node.PrivateKey
|
||||
conf.Stack.Logger = log.New("node.id", conf.Node.ID.String())
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/crypto"
|
||||
|
|
@ -30,7 +31,6 @@ import (
|
|||
"github.com/XinFinOrg/XDPoSChain/rpc"
|
||||
"github.com/docker/docker/pkg/reexec"
|
||||
"github.com/gorilla/websocket"
|
||||
"golang.org/x/exp/slog"
|
||||
)
|
||||
|
||||
// Node represents a node in a simulation network which is created by a
|
||||
|
|
|
|||
Loading…
Reference in a new issue