createLoggingMiddleware function
Convenience Middleware that handles logging depending on projectId.
projectId is the optional Google Cloud Project ID used for trace
correlation.
If projectId is null, returns Middleware composed of logRequests and
badRequestMiddleware.
If projectId is provided, returns the value from cloudLoggingMiddleware.
Implementation
Middleware createLoggingMiddleware({String? projectId}) => projectId == null
? _errorWriter.addMiddleware(logRequests()).addMiddleware(_handleBadRequest)
: cloudLoggingMiddleware(projectId);