コード例 #1
0
        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);
        }
コード例 #2
0
        public DataModel CreateExceptionNotice(Exception ex, string message = null, string level = "error")
        {
            var body  = BodyModelBuilder.CreateExceptionBody(ex);
            var model = Create(level, body);

            // if the exception has a fingerprint property, copy it to the notice
            if (!string.IsNullOrEmpty(body.Trace.Exception.Fingerprint))
            {
                model.Fingerprint = FingerprintHash(body.Trace.Exception.Fingerprint);
            }

            if (body.Trace.Exception.Data != null)
            {
                model.Custom["exception_data"] = body.Trace.Exception.Data;
            }

            model.Title = message;

            return(model);
        }
コード例 #3
0
 public DataModel CreateMessageNotice(string message, string level = "info", IDictionary <string, object> customData = null)
 {
     return(Create(level, BodyModelBuilder.CreateMessageBody(message, customData)));
 }
コード例 #4
0
 public DataModel CreateMessageNotice(string message, string level = "info", IDictionary <string, object> customData = null, IDictionary <string, string> requestSession = null, PersonModel person = null)
 {
     return(Create(level, BodyModelBuilder.CreateMessageBody(message, customData), requestSession, person));
 }