public RequestLog BuildForCurrentRequest()
        {
            var report = new ValueReport();

            _requestData.WriteReport(report);

            var chainId = _currentChain.OriginatingChain == null ? Guid.Empty :
                          _currentChain.OriginatingChain.UniqueId;
            var log = new RequestLog {
                ChainId     = chainId,
                Time        = _systemTime.UtcNow(),
                RequestData = report,
                ChainUrl    = _urls.UrlFor(new ChainRequest {
                    Id = chainId
                }),
                DetailsUrl = _urls.UrlFor(new ChainDetailsRequest {
                    Id = chainId
                })
            };

            if (_currentChain.OriginatingChain.Route != null)
            {
                log.HttpMethod = _request.HttpMethod();
                log.Endpoint   = _request.RelativeUrl();
            }
            else if (_currentChain.OriginatingChain.InputType() != null)
            {
                log.Endpoint   = _currentChain.OriginatingChain.InputType().FullName;
                log.HttpMethod = "n/a";
            }
            else
            {
                log.Endpoint   = ChainVisualization.TitleForChain(_currentChain.OriginatingChain);
                log.HttpMethod = "n/a";
            }

            log.ReportUrl = _urls.UrlFor(log);

            return(log);
        }
Ejemplo n.º 2
0
 public void WriteReport(IValueReport report)
 {
     _inner.WriteReport(report);
 }