public static void TagMessage(ServiceMessage Msg) { Msg.Tag = new Tag(); ((Tag)Msg.Tag).Timer.Start(); //Start the timer on this message }
public static void LogReply(ServiceMessage Msg, ResponseData Response) { Stopwatch timer = ((Tag)Msg.Tag).Timer; timer.Stop(); Debug.WriteLine( "[" + GetFormattedTime(DateTime.Now) + "] " + string.Format("Replied Message {0} with {1} . Processed in {2} ms \n", Msg.Tag, Response.ResponseType.Name, timer.ElapsedMilliseconds ), "MESSAGING"); }
public static void LogNewMessage(ServiceMessage Msg) { if (Msg is ServiceRequest || Msg is GetTransferMessage) { Debug.WriteLine( "[" + GetFormattedTime(DateTime.Now) + "] " + string.Format("Received {0} Message ID {1} for resource {2} from {3}\n", Msg.GetType().Name, Msg.Tag, Msg.Resource, Msg.Source), "MESSAGING"); } else { Debug.WriteLine( "[" + GetFormattedTime(DateTime.Now) + "] " + string.Format("Received {0} Message ID {1} from {2}\n", Msg.GetType().Name, Msg.Tag, Msg.Source), "MESSAGING"); } }
public static void LogMessageUnprotectedError(ServiceMessage Msg) { Debug.WriteLine( "[" + GetFormattedTime(DateTime.Now) + "] " + string.Format("Error: Unencrypted message content from {0} Message ID {1} for resource {2} -- expected encrypted message \n", Msg.GetType().Name, Msg.Tag, Msg.Resource), "MESSAGING"); }
public static void LogMessageError(ServiceMessage Msg, Exception ex) { Debug.WriteLine( "[" + GetFormattedTime(DateTime.Now) + "] " + string.Format("Error processing {0} Message ID {1} for resource {2}. Error Message {3} occured at {4}\n", Msg.GetType().Name, Msg.Tag, Msg.Resource, ex.Message, ex.StackTrace), "MESSAGING"); }
public static void LogIgnoredMessage(ServiceMessage Msg, string Reason) { Debug.WriteLine( "[" + GetFormattedTime(DateTime.Now) + "] " + string.Format("Ignored Message {0}. Reason: {1}\n", Msg.Tag, Reason), "MESSAGING"); }