Exemple #1
0
        public CloudwatchLogs(IAlteredPipeline <TRequest, TResponse> operation, CloudwatchLogsSink logs, string name) : base(async(request) =>
        {
            var requestLog = new
            {
                Time = DateTime.UtcNow,
                AlteredEnvironment.App,
                AlteredEnvironment.Env,
                AlteredEnvironment.Sha,
                Name = name,
                request.RequestId,
                Request = request
            };
            logs.Log(requestLog);

            var response = await operation.Execute(request);

            Debug.Assert(request.RequestId == response.RequestId);
            var responseLog = new
            {
                Time = DateTime.UtcNow,
                AlteredEnvironment.App,
                AlteredEnvironment.Env,
                AlteredEnvironment.Sha,
                Name = name,
                response.RequestId,
                Response = response
            };
            logs.Log(responseLog);

            return(response);
        })
        { }
Exemple #2
0
 public static IAlteredPipeline <TRequest, TResponse> WithCloudwatchLogs <TRequest, TResponse>(this IAlteredPipeline <TRequest, TResponse> operation, CloudwatchLogsSink logs, [CallerMemberName] string name = null)
     where TRequest : IRequestId
     where TResponse : IRequestId, IStatusCode, IRequestDuration, new() =>
 new CloudwatchLogs <TRequest, TResponse>(operation, logs, name);