コード例 #1
0
        /// <summary>
        /// Update Log text box.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="message"></param>
        private void UpdateLog(string source, string message, Exception ex = null)
        {
            if (txtLog.InvokeRequired && txtLog.IsHandleCreated)
            {
                SetUpdateLogCallback d = new SetUpdateLogCallback(UpdateLog);
                this.Invoke(d, new object[] { source, message, ex });
            }
            else
            {
                if (IsDisposed)
                {
                    return;
                }
                if (txtLog.TextLength > Int32.MaxValue / 2)
                {
                    txtLog.Clear();
                }
                txtLog.AppendText("[" + source + "] " + message + Environment.NewLine);

                message = Helper.RemoveAuthInfo(message);
                if (ex == null)
                {
                    Program.Logger.Info("[" + source + "] " + message);
                }
                else
                {
                    Program.Logger.Error("[" + source + "] " + message, ex);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Update Log text box.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="message"></param>
        private void UpdateLog(string source, string message, Exception ex = null)
        {
            if (txtLog.InvokeRequired && txtLog.IsHandleCreated)
            {
                SetUpdateLogCallback d = new SetUpdateLogCallback(UpdateLog);
                this.Invoke(d, new object[] { source, message, ex });
            }
            else
            {
                if (IsDisposed) return;
                if (txtLog.TextLength > Int32.MaxValue / 2) txtLog.Clear();
                txtLog.AppendText("[" + source + "] " + message + Environment.NewLine);

                message = Helper.RemoveAuthInfo(message);
                if (ex == null) Program.Logger.Info("[" + source + "] " + message);
                else Program.Logger.Error("[" + source + "] " + message, ex);
            }
        }