public override string ToString() { string message = $"RequestContent Type - {RequestContentType}; RequestMethod - {RequestMethod}; RequestUrl - {RequestUri};"; message += $"RequestTimeStamp - {RequestTimestamp?.ToShortDateString()}{RequestTimestamp?.ToShortTimeString()};"; message += $"Response TimeStamp - {ResponseTimestamp?.ToShortDateString()}{ResponseTimestamp?.ToShortTimeString()};"; message += $"ResponseContentType - {ResponseContentType} ReponseStatusCode - {ResponseStatusCode.ToString()}"; return(message); }
private int SetBuilderLength() { int BuilderLength = 0; if (string.IsNullOrEmpty(this.RequestUrl) == false) { BuilderLength += RequestUrl.Length; } if (string.IsNullOrEmpty(this.RequestMethod) == false) { BuilderLength += RequestMethod.Length; } if (string.IsNullOrEmpty(this.RequestIp) != true) { BuilderLength += RequestIp.Length; } if (string.IsNullOrEmpty(this.RequestContent) != true) { BuilderLength += RequestContent.Length; } if (this.RequestTimestamp != new DateTime()) { BuilderLength += RequestTimestamp.ToString().Length; } BuilderLength += ResponseTimeCost.ToString().Length; if (string.IsNullOrEmpty(this.ResponseContent) != true) { BuilderLength += ResponseContent.ToString().Length; } return(BuilderLength); }
public override string ToString() { StringBuilder resultStringBuilder = new StringBuilder(SetBuilderLength()); resultStringBuilder.AppendLine(string.Empty); if (string.IsNullOrEmpty(this.RequestUrl) == false) { resultStringBuilder.AppendLine(string.Format("Request Url: {0}", RequestUrl)); } if (string.IsNullOrEmpty(this.RequestMethod) == false) { resultStringBuilder.AppendLine(string.Format("Request Method: {0}", RequestMethod)); } if (string.IsNullOrEmpty(this.RequestIp) != true) { resultStringBuilder.AppendLine(string.Format("Request Ip: {0}", RequestIp)); } if (string.IsNullOrEmpty(this.RequestContent) != true) { resultStringBuilder.AppendLine(string.Format("Request Content: {0}", RequestContent)); } if (this.RequestTimestamp != new DateTime()) { resultStringBuilder.AppendLine(string.Format("Request Timestamp: {0}", RequestTimestamp.ToString("O"))); } resultStringBuilder.AppendLine(string.Format("Response Time Cost: {0} milliseconds", ResponseTimeCost)); if (string.IsNullOrEmpty(this.ResponseContent) != true) { resultStringBuilder.AppendLine(string.Format("Response Content: {0}", ResponseContent)); } resultStringBuilder.AppendLine(string.Empty.Trim()); string resultString = string.Empty.Trim(); resultString = resultStringBuilder.ToString(); resultStringBuilder.Clear(); return(resultString); }
public override string ToString() { return($"{{{nameof(RequestTimestamp)}={RequestTimestamp.ToString()}, {nameof(User)}={User}, {nameof(Direction)}={Direction.ToString()}}}"); }
public void Add(WWCPCPOAdapter CPOAdapter) { _CPOAdapters.Add(CPOAdapter); #region OnGetServiceAuthorisationRequest/-Response CPOAdapter.CPOClient.OnGetServiceAuthorisationRequest += async(LogTimestamp, RequestTimestamp, Sender, SenderId, EventTrackingId, PartnerId, OperatorId, EVSEId, UserId, ServiceId, TransactionId, PartnerServiceSessionId, RequestTimeout) => await DebugLog.SubmitEvent("GetServiceAuthorisationRequest", JSONObject.Create( new JProperty("timestamp", RequestTimestamp.ToIso8601()), new JProperty("eventTrackingId", EventTrackingId.ToString()), //new JProperty("roamingNetworkId", RoamingNetworkId. ToString()), //EMPRoamingProviderId.HasValue // ? new JProperty("EMPRoamingProviderId", EMPRoamingProviderId.ToString()) // : null, //CSORoamingProviderId.HasValue // ? new JProperty("CSORoamingProviderId", CSORoamingProviderId.ToString()) // : null, new JProperty("partnerId", PartnerId.ToString()), new JProperty("operatorId", OperatorId.ToString()), new JProperty("EVSEId", EVSEId.ToString()), new JProperty("userId", UserId.ToString()), new JProperty("serviceId", ServiceId.ToString()), TransactionId.HasValue ? new JProperty("transactionId", TransactionId.ToString()) : null, PartnerServiceSessionId.HasValue ? new JProperty("partnerServiceSessionId", PartnerServiceSessionId.ToString()) : null, new JProperty("requestTimeout", Math.Round(RequestTimeout.TotalSeconds, 0)) )); CPOAdapter.CPOClient.OnGetServiceAuthorisationResponse += async(LogTimestamp, RequestTimestamp, Sender, SenderId, EventTrackingId, PartnerId, OperatorId, EVSEId, UserId, ServiceId, TransactionId, PartnerServiceSessionId, RequestTimeout, Result, Runtime) => await DebugLog.SubmitEvent("GetServiceAuthorisationResponse", JSONObject.Create( new JProperty("timestamp", RequestTimestamp.ToIso8601()), new JProperty("eventTrackingId", EventTrackingId.ToString()), //new JProperty("roamingNetworkId", RoamingNetwork.Id. ToString()), //EMPRoamingProviderId.HasValue // ? new JProperty("EMPRoamingProviderId", EMPRoamingProviderId.ToString()) // : null, //CSORoamingProviderId.HasValue // ? new JProperty("CSORoamingProviderId", CSORoamingProviderId.ToString()) // : null, new JProperty("partnerId", PartnerId.ToString()), new JProperty("operatorId", OperatorId.ToString()), new JProperty("EVSEId", EVSEId.ToString()), new JProperty("userId", UserId.ToString()), new JProperty("serviceId", ServiceId.ToString()), TransactionId.HasValue ? new JProperty("transactionId", TransactionId.ToString()) : null, PartnerServiceSessionId.HasValue ? new JProperty("partnerServiceSessionId", PartnerServiceSessionId.ToString()) : null, new JProperty("requestTimeout", Math.Round(RequestTimeout.TotalSeconds, 0)), new JProperty("result", Result.ToJSON()), new JProperty("runtime", Math.Round(Runtime.TotalMilliseconds, 0)) )); #endregion }