aboutsummaryrefslogtreecommitdiff
path: root/conferences
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2023-08-26 14:14:51 -0400
committerXe Iaso <me@xeiaso.net>2023-08-26 14:14:51 -0400
commit81fe4e8a12b362f7de9a97210f950c388d047664 (patch)
treed71d879f62d74e528a1338470df268669e2565be /conferences
parent924a12ab6915b7dad147ed57c5a384c142f82c1e (diff)
downloadx-81fe4e8a12b362f7de9a97210f950c388d047664.tar.xz
x-81fe4e8a12b362f7de9a97210f950c388d047664.zip
Switch from ln to slog
ln had a good run, but it's not going to last for the long term. I'm going to standardize everything on log/slog and deprecate ln. Closes #385 Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'conferences')
-rw-r--r--conferences/gceu23/cmd/aiyou/main.go11
-rw-r--r--conferences/gceu23/cmd/yuechu/main.go15
2 files changed, 12 insertions, 14 deletions
diff --git a/conferences/gceu23/cmd/aiyou/main.go b/conferences/gceu23/cmd/aiyou/main.go
index ff60cca..c36f428 100644
--- a/conferences/gceu23/cmd/aiyou/main.go
+++ b/conferences/gceu23/cmd/aiyou/main.go
@@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"io/fs"
+ "log"
"net"
"os"
"path/filepath"
@@ -12,8 +13,6 @@ import (
"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
- "within.website/ln"
- "within.website/ln/opname"
"within.website/x/internal"
)
@@ -26,11 +25,11 @@ var (
func main() {
internal.HandleStartup()
- ctx := opname.With(context.Background(), "aiyou")
+ ctx := context.Background()
data, err := os.ReadFile(*binary)
if err != nil {
- ln.FatalErr(ctx, err)
+ log.Fatal(err)
}
r = wazero.NewRuntime(ctx)
@@ -39,7 +38,7 @@ func main() {
code, err = r.CompileModule(ctx, data)
if err != nil {
- ln.FatalErr(ctx, err)
+ log.Fatal(err)
}
config := wazero.NewModuleConfig().
@@ -52,7 +51,7 @@ func main() {
mod, err := r.InstantiateModule(ctx, code, config)
if err != nil {
- ln.Error(ctx, err)
+ log.Fatal(err)
return
}
defer mod.Close(ctx)
diff --git a/conferences/gceu23/cmd/yuechu/main.go b/conferences/gceu23/cmd/yuechu/main.go
index 0b23726..b9798e9 100644
--- a/conferences/gceu23/cmd/yuechu/main.go
+++ b/conferences/gceu23/cmd/yuechu/main.go
@@ -7,6 +7,7 @@ import (
"flag"
"fmt"
"log"
+ "log/slog"
"math/rand"
"net"
"os"
@@ -14,8 +15,6 @@ import (
"github.com/tetratelabs/wazero"
"github.com/tetratelabs/wazero/imports/wasi_snapshot_preview1"
- "within.website/ln"
- "within.website/ln/opname"
"within.website/x/internal"
)
@@ -29,11 +28,11 @@ var (
func main() {
internal.HandleStartup()
- ctx := opname.With(context.Background(), "yuechu")
+ ctx := context.Background()
data, err := os.ReadFile(*binary)
if err != nil {
- ln.FatalErr(ctx, err)
+ log.Fatal(err)
}
r = wazero.NewRuntime(ctx)
@@ -42,15 +41,15 @@ func main() {
code, err = r.CompileModule(ctx, data)
if err != nil {
- ln.FatalErr(ctx, err)
+ log.Fatal(err)
}
server, err := net.Listen("tcp", *bind)
if err != nil {
- ln.FatalErr(ctx, err)
+ log.Fatal(err)
}
- ln.Log(ctx, ln.Action("listening"), ln.F{"bind": *bind})
+ slog.Info("listening", "bind", *bind)
for {
conn, err := server.Accept()
@@ -81,7 +80,7 @@ func main() {
mod, err := r.InstantiateModule(ctx, code, config)
if err != nil {
- ln.Error(ctx, err, ln.F{"remote_host": conn.RemoteAddr().String()})
+ slog.Error("can't instantiate module", "err", err, "remote_host", conn.RemoteAddr().String())
return
}
defer mod.Close(ctx)