b44a46ed2f
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
26 lines
597 B
Go
26 lines
597 B
Go
package honeybee
|
|
|
|
import (
|
|
"context"
|
|
"git.wisehodl.dev/jay/go-honeybee/honeybeetest"
|
|
"git.wisehodl.dev/jay/go-honeybee/transport"
|
|
"github.com/stretchr/testify/assert"
|
|
"testing"
|
|
)
|
|
|
|
func setupTestConnection(t *testing.T) (
|
|
conn *transport.Connection,
|
|
socket *honeybeetest.MockSocket,
|
|
incoming chan honeybeetest.MockIncomingData,
|
|
outgoing chan honeybeetest.MockOutgoingData,
|
|
) {
|
|
t.Helper()
|
|
|
|
socket, incoming, outgoing = honeybeetest.SetupTestSocket(t)
|
|
|
|
var err error
|
|
conn, err = transport.NewConnectionFromSocket(context.Background(), socket, nil, nil)
|
|
assert.NoError(t, err)
|
|
return
|
|
}
|