Skip to content

Commit

Permalink
Upgrade to log/slog.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Aug 22, 2023
1 parent d11fbfc commit e226848
Show file tree
Hide file tree
Showing 21 changed files with 34 additions and 30 deletions.
14 changes: 7 additions & 7 deletions boot/crawl/crawl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func TestCrawler_request_noadvert(t *testing.T) {

sock := socket.New(conn)
c := crawl.New(h, sock, rangeUDP(),
/*socket.WithLogger(logger)*/)
/*socket.WithLogger(logger)*/)
assert.NoError(t, c.Close(), "should close gracefully")
}

Expand Down Expand Up @@ -225,7 +225,7 @@ func TestCrawler_advertise(t *testing.T) {

sock := socket.New(conn)
c := crawl.New(h, sock, rangeUDP(),
/*socket.WithLogger(logger)*/)
/*socket.WithLogger(logger)*/)
defer c.Close()

ttl, err := c.Advertise(ctx, "casm")
Expand Down Expand Up @@ -266,8 +266,8 @@ func TestCrawler_FindPeers_strategy_error(t *testing.T) {
return nil, errFail
}

sock := socket.New(conn)
c := crawl.New(h, sock, fail, /*socket.WithLogger(logger)*/)
sock := socket.New(conn)
c := crawl.New(h, sock, fail /*socket.WithLogger(logger)*/)
defer func() {
assert.NoError(t, c.Close(), "should close gracefully")
}()
Expand Down Expand Up @@ -318,7 +318,7 @@ func TestCrawler_FindPeers_wait(t *testing.T) {
Times(1)

sock := socket.New(conn)
c := crawl.New(h, sock, rangeUDP(&net.UDPAddr{}), /*socket.WithLogger(logger)*/)
c := crawl.New(h, sock, rangeUDP(&net.UDPAddr{}) /*socket.WithLogger(logger)*/)
defer c.Close()

ch, err := c.FindPeers(context.TODO(), "test")
Expand Down Expand Up @@ -379,7 +379,7 @@ func TestCrawler_FindPeers_wait(t *testing.T) {
Times(1)

sock := socket.New(conn)
c := crawl.New(h, sock, rangeUDP(&net.UDPAddr{}), /*socket.WithLogger(logger)*/)
c := crawl.New(h, sock, rangeUDP(&net.UDPAddr{}) /*socket.WithLogger(logger)*/)
defer c.Close()

ch, err := c.FindPeers(context.TODO(), "test")
Expand Down Expand Up @@ -460,7 +460,7 @@ func TestCrawler_find_peers(t *testing.T) {

sock := socket.New(conn)
c := crawl.New(h, sock, rangeUDP(addr),
/*socket.WithLogger(logger)*/)
/*socket.WithLogger(logger)*/)
defer c.Close()

ctx, cancel := context.WithCancel(context.Background())
Expand Down
3 changes: 1 addition & 2 deletions boot/socket/option.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package socket

import (
"log/slog"
"net"

"github.com/wetware/pkg/util/log"

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

type Option func(*Socket)
Expand Down
2 changes: 1 addition & 1 deletion cap/csp/proc/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"
"net"

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

"capnproto.org/go/capnp/v3"
"capnproto.org/go/capnp/v3/exp/bufferpool"
Expand Down
3 changes: 2 additions & 1 deletion cap/csp/server/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import (
"os"
"time"

"log/slog"

"capnproto.org/go/capnp/v3"
"capnproto.org/go/capnp/v3/rpc"
"github.com/ipfs/go-cid"
"github.com/stealthrocket/wazergo"
"github.com/tetratelabs/wazero"
wasm "github.com/tetratelabs/wazero/api"
"github.com/tetratelabs/wazero/experimental/sock"
"golang.org/x/exp/slog"

api "github.com/wetware/pkg/api/process"
"github.com/wetware/pkg/cap/csp"
Expand Down
3 changes: 2 additions & 1 deletion cap/pubsub/refcount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"testing"

"log/slog"

capnp "capnproto.org/go/capnp/v3"
"github.com/golang/mock/gomock"
"github.com/libp2p/go-libp2p"
Expand All @@ -14,7 +16,6 @@ import (
"github.com/stretchr/testify/require"
api "github.com/wetware/pkg/api/pubsub"
test_log "github.com/wetware/pkg/util/log/test"
"golang.org/x/exp/slog"
)

func TestTopicManager(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cap/pubsub/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package pubsub
import (
"context"

"log/slog"

capnp "capnproto.org/go/capnp/v3"
pubsub "github.com/libp2p/go-libp2p-pubsub"
api "github.com/wetware/pkg/api/pubsub"
"github.com/wetware/pkg/util/log"
"golang.org/x/exp/slog"
)

// Router is a client capability that confers the right to join pubsub
Expand Down
3 changes: 1 addition & 2 deletions client/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"strings"

"capnproto.org/go/capnp/v3/rpc"
Expand All @@ -13,8 +14,6 @@ import (
"github.com/wetware/pkg/system"
"github.com/wetware/pkg/util/log"
"github.com/wetware/pkg/util/proto"

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

var ErrNoPeers = errors.New("no peers")
Expand Down
3 changes: 2 additions & 1 deletion cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (
"sync/atomic"
"time"

"log/slog"

"capnproto.org/go/capnp/v3"
"github.com/jpillora/backoff"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"golang.org/x/exp/slog"

"github.com/lthibault/jitterbug/v2"

Expand Down
3 changes: 2 additions & 1 deletion cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"testing"
"time"

"log/slog"

"github.com/golang/mock/gomock"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/wetware/pkg/cluster"
test_cluster "github.com/wetware/pkg/cluster/test"
"golang.org/x/exp/slog"

"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/ww/cluster/cluster.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cluster

import (
"log/slog"
"path"
"runtime"
"time"
Expand All @@ -10,7 +11,6 @@ import (
quic "github.com/libp2p/go-libp2p/p2p/transport/quic"
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
"github.com/urfave/cli/v2"
"golang.org/x/exp/slog"

"github.com/wetware/pkg/cap/host"
"github.com/wetware/pkg/client"
Expand Down
3 changes: 2 additions & 1 deletion cmd/ww/ls/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package ls
import (
"fmt"

"log/slog"

"github.com/urfave/cli/v2"
"golang.org/x/exp/slog"

"github.com/wetware/pkg/cap/host"
"github.com/wetware/pkg/cap/view"
Expand Down
2 changes: 1 addition & 1 deletion cmd/ww/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"context"
_ "embed"
"fmt"
"log/slog"
"os"
"os/signal"
"path"
Expand All @@ -17,7 +18,6 @@ import (

"github.com/tetratelabs/wazero/sys"
"github.com/urfave/cli/v2"
"golang.org/x/exp/slog"

ww "github.com/wetware/pkg"
"github.com/wetware/pkg/cmd/ww/cluster"
Expand Down
2 changes: 1 addition & 1 deletion cmd/ww/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package run

import (
"errors"
"log/slog"
"os"

"capnproto.org/go/capnp/v3"
Expand All @@ -12,7 +13,6 @@ import (
"github.com/wetware/pkg/client"
"github.com/wetware/pkg/rom"
"github.com/wetware/pkg/system"
"golang.org/x/exp/slog"
)

var flags = []cli.Flag{
Expand Down
2 changes: 1 addition & 1 deletion cmd/ww/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package start
import (
"context"
"fmt"
"log/slog"
"strings"

"github.com/libp2p/go-libp2p"
quic "github.com/libp2p/go-libp2p/p2p/transport/quic"
tcp "github.com/libp2p/go-libp2p/p2p/transport/tcp"
"github.com/urfave/cli/v2"
"github.com/wetware/pkg/server"
"golang.org/x/exp/slog"
)

var meta map[string]string
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ require (
github.com/stretchr/testify v1.8.4
github.com/tetratelabs/wazero v1.3.1
go.uber.org/multierr v1.11.0
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
golang.org/x/sync v0.3.0
golang.org/x/time v0.3.0
lukechampine.com/blake3 v1.2.1
Expand Down Expand Up @@ -136,6 +135,7 @@ require (
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.uber.org/dig v1.17.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
Expand Down
3 changes: 1 addition & 2 deletions guest/system/logging.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package system

import (
"log/slog"
"os"

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

func init() {
Expand Down
2 changes: 1 addition & 1 deletion guest/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package system
import (
"context"
"io"
"log/slog"
"net"
"os"
"runtime"
"syscall"

"capnproto.org/go/capnp/v3/rpc"
"github.com/wetware/pkg/system"
"golang.org/x/exp/slog"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"log/slog"
"strings"

"github.com/libp2p/go-libp2p"
Expand All @@ -25,7 +26,6 @@ import (
"github.com/wetware/pkg/system"
"github.com/wetware/pkg/util/log"
"github.com/wetware/pkg/util/proto"
"golang.org/x/exp/slog"
)

type ClientProvider interface {
Expand Down
2 changes: 1 addition & 1 deletion system/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package system
import (
"context"
"errors"
"log/slog"

"capnproto.org/go/capnp/v3/exc"
"github.com/wetware/pkg/util/log"
"golang.org/x/exp/slog"
)

// ErrorReporter handles Cap'n Proto RPC errors.
Expand Down
2 changes: 1 addition & 1 deletion system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package system
import (
"context"
"fmt"
"log/slog"
"net"
"time"

Expand All @@ -15,7 +16,6 @@ import (
"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
"github.com/wetware/pkg/util/log"
"go.uber.org/multierr"
"golang.org/x/exp/slog"
)

type Closer struct {
Expand Down
3 changes: 2 additions & 1 deletion ww.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import (
"net"
"runtime"

"log/slog"

"capnproto.org/go/capnp/v3"
"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/api"
"github.com/tetratelabs/wazero/experimental/sock"
"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
"github.com/tetratelabs/wazero/sys"
"golang.org/x/exp/slog"

csp_server "github.com/wetware/pkg/cap/csp/server"
"github.com/wetware/pkg/rom"
Expand Down

0 comments on commit e226848

Please sign in to comment.