Migrate logging to go-mana-component; delete logging/ package

Replaces the flat key-value logging scheme with component-based structured
logging via go-mana-component. Each layer (pool, worker, connection) builds
its own component identity and derives a *slog.Logger from a caller-supplied
slog.Handler.

- Delete logging/ package (logging.go, logging_test.go)
- Strip LoggingEnabled and LogLevel from ConnectionConfig, PoolConfig,
 WorkerConfig; remove associated option funcs
- Change NewConnection and NewConnectionFromSocket to accept ctx and
 slog.Handler instead of *slog.Logger; constructors build component
 identity via MustNew/MustExtend internally
- Change WorkerFactory, NewWorker, connect, and RunDialer to carry
 slog.Handler; remove PoolPlugin.Handler
- Change NewPool to establish pool component identity via MustNew;
 remove pool_id field, PoolPlugin.ID, and ErrInvalidPoolID
- Fix data race in MockSlogHandler: WithAttrs now shares parent mutex
 pointer rather than allocating a new one per child
- Run go fix
This commit is contained in:
Jay
2026-05-20 11:44:54 -04:00
parent 5b31db304a
commit b44a46ed2f
28 changed files with 179 additions and 464 deletions
+7 -6
View File
@@ -2,6 +2,7 @@ package transport
import (
"bytes"
"context"
"fmt"
"git.wisehodl.dev/jay/go-honeybee/honeybeetest"
"github.com/gorilla/websocket"
@@ -11,7 +12,7 @@ import (
func TestDisconnectedConnectionClose(t *testing.T) {
t.Run("close succeeds on disconnected connection", func(t *testing.T) {
conn, err := NewConnection("ws://test", nil, nil)
conn, err := NewConnection(context.Background(), "ws://test", nil, nil)
assert.NoError(t, err)
assert.Equal(t, StateDisconnected, conn.State())
@@ -20,7 +21,7 @@ func TestDisconnectedConnectionClose(t *testing.T) {
})
t.Run("close is idempotent", func(t *testing.T) {
conn, err := NewConnection("ws://test", nil, nil)
conn, err := NewConnection(context.Background(), "ws://test", nil, nil)
assert.NoError(t, err)
conn.Close()
@@ -29,7 +30,7 @@ func TestDisconnectedConnectionClose(t *testing.T) {
})
t.Run("close with nil socket", func(t *testing.T) {
conn, err := NewConnection("ws://test", nil, nil)
conn, err := NewConnection(context.Background(), "ws://test", nil, nil)
assert.NoError(t, err)
assert.Nil(t, conn.socket)
@@ -44,7 +45,7 @@ func TestDisconnectedConnectionClose(t *testing.T) {
return expectedErr
}
conn, err := NewConnection("ws://test", nil, nil)
conn, err := NewConnection(context.Background(), "ws://test", nil, nil)
assert.NoError(t, err)
conn.socket = mockSocket
@@ -53,7 +54,7 @@ func TestDisconnectedConnectionClose(t *testing.T) {
})
t.Run("channels close after close", func(t *testing.T) {
conn, err := NewConnection("ws://test", nil, nil)
conn, err := NewConnection(context.Background(), "ws://test", nil, nil)
assert.NoError(t, err)
conn.Close()
@@ -66,7 +67,7 @@ func TestDisconnectedConnectionClose(t *testing.T) {
})
t.Run("send fails after close", func(t *testing.T) {
conn, err := NewConnection("ws://test", nil, nil)
conn, err := NewConnection(context.Background(), "ws://test", nil, nil)
assert.NoError(t, err)
conn.Close()