Commit 123aacbd LN

日志修改

1 个父辈 73363f32
......@@ -19,7 +19,6 @@ namespace OnlineStore.Common
public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>();
public static System.Windows.Forms.RichTextBox logBox = null;
public static int showCount = 20;
public static bool debug_opened = false;
......@@ -97,17 +96,27 @@ namespace OnlineStore.Common
try
{
//if (logList.Count > 0)
//{
// logList.RemoveAt(0);
//}
//if (logList.Count >= showCount)
//{
// logList.RemoveAt(logList.Count - 1);
//}
//System.DateTime now = System.DateTime.Now;
//logList.Insert(0, now.ToLongTimeString() + " " + msg + Environment.NewLine);
//logList.Insert(0, Environment.NewLine);
if (logList.Count > 0)
{
logList.RemoveAt(0);
// logList.RemoveAt(0);
}
if (logList.Count >= showCount)
{
logList.RemoveAt(logList.Count - 1);
logList.RemoveAt(0);
}
System.DateTime now = System.DateTime.Now;
logList.Insert(0, now.ToLongTimeString() + " " + msg + Environment.NewLine);
logList.Insert(0, Environment.NewLine);
string text = "";
foreach (string str in logList)
{
......@@ -117,7 +126,15 @@ namespace OnlineStore.Common
{
return;
}
logBox.Text = text;
System.DateTime now = System.DateTime.Now;
logList.Add(now.ToLongTimeString() + " " + msg + Environment.NewLine);
// logBox.Focus(); //使文本框获取焦点
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine); //增加文本
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾
logBox.ScrollToCaret(); //滚动到控件光标处
}
catch (Exception ex)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!