static Errors() { Set <int> codes = new Set <int>(); // verify integrity of error codes foreach (FieldInfo fi in typeof(Errors).GetFields(BindingFlags.Public | BindingFlags.Static)) { ErrorDesc error_desc = (ErrorDesc)fi.GetValue(null); switch (error_desc.Severity) { case Severity.Error: Debug.Assert(error_desc.ErrorCode < 2000); break; case Severity.Warning: Debug.Assert(error_desc.ErrorCode >= 2000 && error_desc.ErrorCode < 3000); break; case Severity.Info: Debug.Assert(error_desc.ErrorCode >= 3000); break; } Debug.Assert(!codes.Contains(error_desc.ErrorCode)); codes.Add(error_desc.ErrorCode); } }
public void Add(ErrorDesc error, params object[] args) { Add(new LogEntry(error.ErrorCode, error.Severity, String.Format(error.Message, args))); }
public void Add(ErrorDesc error, object arg1, object arg2, object arg3) { Add(new LogEntry(error.ErrorCode, error.Severity, String.Format(error.Message, arg1, arg2, arg3))); }
public void Add(ErrorDesc error) { Add(new LogEntry(error.ErrorCode, error.Severity, error.Message)); }
public void Add(ErrorDesc error, params object[] args) { Add(new LogEntry(error.ErrorCode, error.Severity, String.Format(error.Message, args))); }
public void Add(ErrorDesc error, object arg1, object arg2, object arg3) { Add(new LogEntry(error.ErrorCode, error.Severity, String.Format(error.Message, arg1, arg2, arg3))); }
public void Add(ErrorDesc error) { Add(new LogEntry(error.ErrorCode, error.Severity, error.Message)); }