Пример #1
0
        public void DebugLog(Exception e, DebugLevel Level)
        {
            StackFrame x          = new StackTrace(e).GetFrame(0);
            string     MethodName = x.GetMethod().Name;
            string     Filename   = x.GetFileName();
            int        Line       = x.GetFileLineNumber();
            TDebugInfo db         = new TDebugInfo()
            {
                Filename   = Filename,
                Level      = DebugLevel.F,
                Line       = Line,
                MethodName = MethodName,
                Text       = e.Message + Environment.NewLine + e.StackTrace,
                Time       = DateTime.Now
            };

            if (DebugList.Count > DebugCount)
            {
                DebugList.RemoveAt(0);
            }
            DebugList.Add(db);
            OnError(this, new LogArgs()
            {
                DebugInfo = db
            });
        }
Пример #2
0
        public void DebugLog(string Text, DebugLevel Level)
        {
            StackFrame x          = new StackTrace(true).GetFrame(1);
            string     MethodName = x.GetMethod().Name;
            string     Filename   = x.GetFileName();
            int        Line       = x.GetFileLineNumber();
            TDebugInfo db         = new TDebugInfo()
            {
                Filename   = Filename,
                Level      = Level,
                Line       = Line,
                MethodName = MethodName,
                Text       = Text,
                Time       = DateTime.Now
            };

            if (DebugList.Count > DebugCount)
            {
                DebugList.RemoveAt(0);
            }
            DebugList.Add(db);

            if (this.OnError != null)
            {
                OnError(this, new LogArgs()
                {
                    DebugInfo = db
                });
            }
        }
Пример #3
0
        private void PageQueryDebugLog(int VillageID, string Uri)
        {
            var        st         = new StackTrace(true);
            StackFrame x          = null;
            string     MethodName = null;
            int        i;

            for (i = 2; i < st.FrameCount; i++)
            {
                x          = st.GetFrame(i);
                MethodName = x.GetMethod().Name;
                if (MethodName != "PageQuery")
                {
                    break;
                }
            }
            if (i == st.FrameCount)
            {
                x          = st.GetFrame(3);
                MethodName = x.GetMethod().Name;
            }
            string     Filename = x.GetFileName();
            int        Line     = x.GetFileLineNumber();
            TDebugInfo db       = new TDebugInfo()
            {
                Filename   = Filename,
                Level      = DebugLevel.II,
                Line       = Line,
                MethodName = MethodName,
                Text       = "Page: " + Uri + " (" + VillageID.ToString() + ")",
                Time       = DateTime.Now
            };

            OnError(this, new LogArgs()
            {
                DebugInfo = db
            });
        }
Пример #4
0
 private void PageQueryDebugLog(int VillageID, string Uri)
 {
     var st = new StackTrace(true);
     StackFrame x = null;
     string MethodName = null;
     int i;
     for(i = 2; i < st.FrameCount; i++)
     {
         x = st.GetFrame(i);
         MethodName = x.GetMethod().Name;
         if(MethodName != "PageQuery")
             break;
     }
     if(i == st.FrameCount)
     {
         x = st.GetFrame(3);
         MethodName = x.GetMethod().Name;
     }
     string Filename = x.GetFileName();
     int Line = x.GetFileLineNumber();
     TDebugInfo db = new TDebugInfo()
     {
         Filename = Filename,
         Level = DebugLevel.II,
         Line = Line,
         MethodName = MethodName,
         Text = "Page: " + Uri + " (" + VillageID.ToString() + ")",
         Time = DateTime.Now
     };
     OnError(this, new LogArgs() { DebugInfo = db });
 }
Пример #5
0
 public void DebugLog(Exception e, DebugLevel Level)
 {
     StackFrame x = new StackTrace(e).GetFrame(0);
     string MethodName = x.GetMethod().Name;
     string Filename = x.GetFileName();
     int Line = x.GetFileLineNumber();
     TDebugInfo db = new TDebugInfo()
     {
         Filename = Filename,
         Level = DebugLevel.F,
         Line = Line,
         MethodName = MethodName,
         Text = e.Message + Environment.NewLine + e.StackTrace,
         Time = DateTime.Now
     };
     if(DebugList.Count > DebugCount)
         DebugList.RemoveAt(0);
     DebugList.Add(db);
     OnError(this, new LogArgs() { DebugInfo = db });
 }
Пример #6
0
        public void DebugLog(string Text, DebugLevel Level)
        {
            StackFrame x = new StackTrace(true).GetFrame(1);
            string MethodName = x.GetMethod().Name;
            string Filename = x.GetFileName();
            int Line = x.GetFileLineNumber();
            TDebugInfo db = new TDebugInfo()
            {
                Filename = Filename,
                Level = Level,
                Line = Line,
                MethodName = MethodName,
                Text = Text,
                Time = DateTime.Now
            };
            if(DebugList.Count > DebugCount)
                DebugList.RemoveAt(0);
            DebugList.Add(db);

            if (this.OnError != null)
            {
                OnError(this, new LogArgs() { DebugInfo = db });
            }
        }
Пример #7
0
 private void DebugWriteError(TDebugInfo DB)
 {
     string str = string.Format("[{2,-3}{0} {1}]{3,22}@{4,-22}:{5,-4} {6}",
             DB.Time.Day,
             DB.Time.ToLongTimeString(),
             DB.Level.ToString(),
             DB.MethodName,
         //DB.Filename.Substring(13),
             Path.GetFileNameWithoutExtension(DB.Filename),
             DB.Line,
             DB.Text);
     if (checkBoxVerbose.Checked || DB.Level != DebugLevel.II)
         textBox1.AppendText(str + "\r\n");
     LastDebug.Text = str.Replace("\r\n", "");
 }
Пример #8
0
 private void DebugWriteError(TDebugInfo DB)
 {
     string str = string.Format("[{2,-3}{0} {1}]{3,20}@{4,-35}:{5,-3} {6}",
         DB.Time.Day,
         DB.Time.ToLongTimeString(),
         DB.Level.ToString(),
         DB.MethodName,
         DB.Filename.Substring(13),
         DB.Line,
         DB.Text);
     if (checkBoxVerbose.Checked || DB.Level != DebugLevel.II)
         textBox1.AppendText(str + "\r\n");
     LastDebug.Text = str;
 }