Logger to inject
Object with withToolLogging, withResourceLogging, withPromptLogging methods
const loggingMiddleware = createLoggingMiddleware({ logger });
const tools = Object.values(toolFactories)
.map(f => f())
.map(authMiddleware.withToolAuth) // Auth middleware first
.map(loggingMiddleware.withToolLogging); // Logging middleware second
const resources = Object.values(resourceFactories)
.map(f => f())
.map(authMiddleware.withResourceAuth)
.map(loggingMiddleware.withResourceLogging);
Create logging middleware that injects logger into EnrichedExtra