Last active
June 11, 2018 16:27
-
-
Save skenderbeu/c20e390e76cde1f855b765fd8132f608 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.ServiceModel.Channels; | |
namespace RoyalMail | |
{ | |
public class RequestMessage: LogMessage | |
{ | |
public RequestMessage(Guid guid) | |
{ | |
fileName = string.Format("{0}RoyalMailLog_{1:000}_{2}_Outgoing.txt", | |
Properties.Settings.Default.RoyalMailLog, GetDateStamp(), guid); | |
} | |
protected override void CreateMessage(Message message, StreamWriter sw) | |
{ | |
Uri requestUri = message.Headers.To; | |
HttpRequestMessageProperty httpReq | |
= (HttpRequestMessageProperty)message.Properties[HttpRequestMessageProperty.Name]; | |
sw.WriteLine("{0} {1}", httpReq.Method, requestUri); | |
foreach (var header in httpReq.Headers.AllKeys) | |
{ | |
sw.WriteLine("{0}: {1}", header, httpReq.Headers[header]); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment