Skip to content

Commit 946c085

Browse files
committed
log: use native log/slog instead of golang/exp (ethereum#29302)
1 parent 40fd68a commit 946c085

File tree

11 files changed

+13
-16
lines changed

11 files changed

+13
-16
lines changed

internal/debug/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ package debug
2323
import (
2424
"errors"
2525
"io"
26+
"log/slog"
2627
"os"
2728
"os/user"
2829
"path/filepath"
@@ -35,7 +36,6 @@ import (
3536
"time"
3637

3738
"github.com/XinFinOrg/XDPoSChain/log"
38-
"golang.org/x/exp/slog"
3939
)
4040

4141
// Handler is the global debugging handler.

internal/debug/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package debug
1919
import (
2020
"fmt"
2121
"io"
22+
"log/slog"
2223
"net/http"
2324
_ "net/http/pprof"
2425
"os"
@@ -30,7 +31,6 @@ import (
3031
"github.com/XinFinOrg/XDPoSChain/metrics/exp"
3132
"github.com/mattn/go-colorable"
3233
"github.com/mattn/go-isatty"
33-
"golang.org/x/exp/slog"
3434
"gopkg.in/natefinch/lumberjack.v2"
3535
"gopkg.in/urfave/cli.v1"
3636
)

internal/testlog/testlog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121
"bytes"
2222
"context"
2323
"fmt"
24+
"log/slog"
2425
"sync"
2526
"testing"
2627

2728
"github.com/XinFinOrg/XDPoSChain/log"
28-
"golang.org/x/exp/slog"
2929
)
3030

3131
const (

log/format.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package log
33
import (
44
"bytes"
55
"fmt"
6+
"log/slog"
67
"math/big"
78
"reflect"
89
"strconv"
910
"time"
1011
"unicode/utf8"
1112

1213
"github.com/holiman/uint256"
13-
"golang.org/x/exp/slog"
1414
)
1515

1616
const (

log/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import (
44
"context"
55
"fmt"
66
"io"
7+
"log/slog"
78
"math/big"
89
"reflect"
910
"sync"
1011
"time"
1112

1213
"github.com/holiman/uint256"
13-
"golang.org/x/exp/slog"
1414
)
1515

1616
type discardHandler struct{}

log/handler_glog.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ import (
2020
"context"
2121
"errors"
2222
"fmt"
23+
"log/slog"
2324
"regexp"
2425
"runtime"
2526
"strconv"
2627
"strings"
2728
"sync"
2829
"sync/atomic"
29-
30-
"golang.org/x/exp/slog"
3130
)
3231

3332
// errVmoduleSyntax is returned when a user vmodule pattern is invalid.

log/logger.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ package log
22

33
import (
44
"context"
5+
"log/slog"
56
"math"
67
"os"
78
"runtime"
89
"time"
9-
10-
"golang.org/x/exp/slog"
1110
)
1211

1312
const errorKey = "LOG_ERROR"

log/logger_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import (
55
"errors"
66
"fmt"
77
"io"
8+
"log/slog"
89
"math/big"
910
"os"
1011
"strings"
1112
"testing"
1213
"time"
1314

1415
"github.com/holiman/uint256"
15-
"golang.org/x/exp/slog"
1616
)
1717

1818
// TestLoggingWithVmodule checks that vmodule works.

log/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ package log
22

33
import (
44
"context"
5+
"log/slog"
56
"os"
67
"sync/atomic"
7-
8-
"golang.org/x/exp/slog"
98
)
109

1110
var root atomic.Value

p2p/simulations/adapters/exec.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"errors"
2525
"fmt"
2626
"io"
27+
"log/slog"
2728
"net"
2829
"os"
2930
"os/exec"
@@ -42,7 +43,6 @@ import (
4243
"github.com/XinFinOrg/XDPoSChain/rpc"
4344
"github.com/docker/docker/pkg/reexec"
4445
"github.com/gorilla/websocket"
45-
"golang.org/x/exp/slog"
4646
)
4747

4848
// ExecAdapter is a NodeAdapter which runs simulation nodes by executing the
@@ -384,7 +384,7 @@ func initLogging() {
384384
// and the node config from an environment variable.
385385
func execP2PNode() {
386386
initLogging()
387-
387+
388388
// read the services from argv
389389
serviceNames := strings.Split(os.Args[1], ",")
390390

@@ -395,7 +395,7 @@ func execP2PNode() {
395395
}
396396
var conf execNodeConfig
397397
if err := json.Unmarshal([]byte(confEnv), &conf); err != nil {
398-
log.Crit("error decoding " + envNodeConfig, "err", err)
398+
log.Crit("error decoding "+envNodeConfig, "err", err)
399399
}
400400
conf.Stack.P2P.PrivateKey = conf.Node.PrivateKey
401401
conf.Stack.Logger = log.New("node.id", conf.Node.ID.String())

0 commit comments

Comments
 (0)