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
+4 -6
View File
@@ -12,15 +12,14 @@ import (
func TestIdleWatchdog(t *testing.T) {
t.Run("heartbeat resets timer, onTimeout not called", func(t *testing.T) {
activity := make(chan struct{})
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := t.Context()
called := atomic.Bool{}
go IdleWatchdog(
ctx, activity, 200*time.Millisecond, func() { called.Store(true) },
)
for i := 0; i < 5; i++ {
for range 5 {
time.Sleep(20 * time.Millisecond)
activity <- struct{}{}
}
@@ -32,8 +31,7 @@ func TestIdleWatchdog(t *testing.T) {
t.Run("timeout fires onTimeout exactly once", func(t *testing.T) {
activity := make(chan struct{})
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx := t.Context()
count := atomic.Int32{}
done := make(chan struct{})
@@ -123,7 +121,7 @@ func TestIdleWatchdog(t *testing.T) {
}()
// these must not block
for i := 0; i < 5; i++ {
for range 5 {
activity <- struct{}{}
}