private static LogEntry CreateLogEntry(Exception ex, Constants.Category c, Constants.Severity s, IDictionary <string, object> d = null) { LogEntry logentry = new LogEntry(); logentry.Message = ex.Message; logentry.Severity = MapToTraceEventType(s); logentry.Title = c.ToString(); return(logentry); }
static internal TraceEventType MapToTraceEventType(Constants.Severity s) { switch (s) { case Constants.Severity.Critical: return(TraceEventType.Critical); case Constants.Severity.Error: return(TraceEventType.Error); case Constants.Severity.Information: return(TraceEventType.Information); case Constants.Severity.Verbose: return(TraceEventType.Verbose); case Constants.Severity.Warning: return(TraceEventType.Warning); default: throw new Exception("Invalid Severity"); } }
/// <summary> /// For Audit Log with extended properties /// </summary> /// <param name="message"></param> /// <param name="c"></param> /// <param name="s"></param> /// <param name="d"></param> /// <returns></returns> private static LogEntry CreateLogEntryWithObject(string message, Constants.Category c, Constants.Severity s, IDictionary <string, object> d) { LogEntry logentry = new LogEntry(); logentry.Message = message; logentry.Severity = MapToTraceEventType(s); logentry.Title = c.ToString(); logentry.ExtendedProperties = d; return(logentry); }