@mcp-z/server
    Preparing search index...

    Function createLoggingMiddleware

    • Create logging middleware that injects logger into EnrichedExtra

      Parameters

      Returns {
          withPromptLogging: <
              T extends { config: unknown; handler: unknown; name: string },
          >(
              module: T,
          ) => T;
          withResourceLogging: <
              T extends
                  {
                      config?: unknown;
                      handler: unknown;
                      name: string;
                      template?: unknown;
                  },
          >(
              module: T,
          ) => T;
          withToolLogging: <
              T extends { config: unknown; handler: unknown; name: string },
          >(
              module: T,
          ) => T;
      }

      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);