public void Message(MessageSeverity severity, int code, string message, params object[] args) { var msg = new Message(severity, code, Region, message, args); string s = msg.ToString(); // Ensure this does not throw an exception AllMessages.Add(msg); if (_logToConsole) Console.WriteLine(s); }
public void Message(MessageSeverity severity, int code, string message, params object[] args) { var msg = new Message(severity, code, Region, message, args); foreach (var a in args) { try { new BinaryFormatter().Serialize(new MemoryStream(), a); } catch (Exception) { throw new Exception("Error serializing argument " + a); } } string s = msg.ToString(); // Ensure this does not throw an exception AllMessages.Add(msg); if (_logToConsole) Console.WriteLine(s); }
public bool Equals(Message other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Severity, Severity) && other.Code == Code && Equals(other.File, File) && other.Location.Equals(Location) && Equals(other.Format, Format) && ArgsEqual(other.Args, Args); }