示例#1
0
        /// <summary>
        /// The part of the log with high enough severity.
        /// </summary>
        /// <param name="cutoff">Do not show messages below this severity.</param>
        /// <returns>A string representation of all suitable messages in the log.</returns>
        public IEnumerable <string> Message(DiagnosisMessage.Importance cutoff)
        {
            bool coreBugFound = false;

            IEnumerable <DiagnosisMessage> suitable = this.messages.Where(m => m.MessageImportance >= cutoff);
            // remove duplicated messages
            Dictionary <string, Tuple <int, DiagnosisMessage> > repeats = new Dictionary <string, Tuple <int, DiagnosisMessage> >();

            foreach (DiagnosisMessage s in suitable)
            {
                if (s.MessageImportance == DiagnosisMessage.Importance.CoreBug)
                {
                    coreBugFound = true;
                }
                if (repeats.ContainsKey(s.Message))
                {
                    repeats[s.Message] = Tuple.Create(repeats[s.Message].Item1 + 1, repeats[s.Message].Item2);
                }
                else
                {
                    repeats[s.Message] = new Tuple <int, DiagnosisMessage>(1, s);
                }
            }

            foreach (var m in repeats)
            {
                var count = m.Value.Item1;
                var msg   = m.Value.Item2.ToString();
                if (count > 1)
                {
                    msg += " [repeated " + count + " times]";
                }
                yield return(msg);
            }

            if (coreBugFound)
            {
                yield return("This is a bug in the underlying system (Dryad/DryadLINQ/Quincy).  You can report this diagnosis to the DryadLINQ developers at drylnqin");
            }
        }
示例#2
0
 /// <summary>
 /// Write a log message to the diagnosis log.
 /// </summary>
 /// <param name="importance">Message importance.</param>
 /// <param name="message">Message to write.</param>
 /// <param name="details">Additional message details.</param>
 protected void Log(DiagnosisMessage.Importance importance, string message, string details)
 {
     this.diagnosisLog.AddMessage(new DiagnosisMessage(importance, message, details));
 }