예제 #1
0
파일: Main.cs 프로젝트: uvbs/babbot
 private static void LogMessage(string Message)
 {
     if (Logger != null)
     {
         Logger.Log(string.Format("[{0}]: {1}", DateTime.Now.ToLongTimeString(), Message));
     }
 }
예제 #2
0
        override protected void SendBuffer(LoggingEvent[] events)
        {
            foreach (LoggingEvent e in events)
            {
                try
                {
                    string ip      = null;
                    string culture = null;
                    string url     = null;

                    if (e.Properties["ip"] != null)
                    {
                        ip = e.Properties["ip"].ToString();
                    }
                    if (e.Properties["culture"] != null)
                    {
                        culture = e.Properties["culture"].ToString();
                    }
                    if (e.Properties["url"] != null)
                    {
                        url = e.Properties["url"].ToString();
                    }

                    SystemLog.Log(ip, culture, url, e.ThreadName, e.Level.Name, e.LoggerName, e.RenderedMessage + " " + e.GetExceptionString());
                }
                catch { } //can't allow throwing exceptions here and can't log them since it would be recursive and possibly an infinite loop/race condition
            }
        }
예제 #3
0
 private void InvokeValueChangeEvent()
 {
     if (_hasChange)
     {
         _hasChange = false;
         string currentData = _textEdit.Text;
         if (currentData != _dirtyData)
         {
             _dirtyData = currentData;
             if (valueChanged != null)
             {
                 try
                 {
                     valueChanged();
                 }
                 catch (Exception ex)
                 {
                     SystemLog.Log(ex);
                 }
             }
         }
     }
 }