LogOut.cs 1007 字节
using System;

namespace Model
{
    public class LogOut
    {
        private readonly log4net.ILog log;
        public System.Windows.Forms.TextBox LogBox { set; get; }

        public LogOut(string name)
        {
            log = log4net.LogManager.GetLogger(name);
        }

        public void UIShow(string s)
        {
            if (LogBox == null) return;
            string time = string.Format("[{0:HH:mm:ss}] ", DateTime.Now);
            LogBox.AppendText(time + s + "\r\n");
            LogBox.ScrollToCaret();
        }

        public void Error(string s, Exception ex)
        {
            log.Error(s, ex);
        }

        public void Debug(string s)
        {
            log.Debug(s);
        }

        public void Info(string s)
        {
            log.Info(s);
        }

        public void Fatal(string s, Exception ex)
        {
            log.Fatal(s, ex);
        }

        public void Warn(string s)
        {
            log.Warn(s);
        }
        

    }
}