public DataModel CreateExceptionNotice(Exception ex, string message = null, string level = "error") { var body = BodyModelBuilder.CreateExceptionBody(ex); var model = Create(level, body); //merge exception data dictionaries to list of keyValues pairs var keyValuePairs = body.TraceChain.Where(tm => tm.Exception.Data != null).SelectMany(tm => tm.Exception.Data); foreach (var keyValue in keyValuePairs) { //the keys in keyValuePairs aren't necessarily unique, so don't add but overwrite model.Custom[keyValue.Key.ToString()] = keyValue.Value; } model.Title = message; return(model); }
public DataModel CreateMessageNotice(string message, string level = "info", IDictionary <string, object> customData = null) { return(Create(level, BodyModelBuilder.CreateMessageBody(message, customData))); }