示例#1
0
        public void AddWarning(string message, Exception ex)
        {
            if (m_parent != null)
            {
                m_parent.AddWarning(message, ex);
            }
            else
            {
                lock (Logging.Log.Lock)
                {
                    if (m_is_reporting)
                    {
                        return;
                    }

                    try
                    {
                        m_is_reporting = true;
                        Logging.Log.WriteMessage(message, Duplicati.Library.Logging.LogMessageType.Warning, ex);

                        var s = ex == null ? message : string.Format("{0} => {1}", message, VerboseErrors ? ex.ToString() : ex.Message);
                        m_warnings.Add(s);

                        if (MessageSink != null)
                        {
                            MessageSink.WarningEvent(message, ex);
                        }

                        lock (m_lock)
                            if (m_db != null && !m_db.IsDisposed)
                            {
                                LogDbMessage("Warning", message, ex);
                            }
                    }
                    finally
                    {
                        m_is_reporting = false;
                    }
                }
            }
        }
示例#2
0
        public void AddWarning(string message, Exception ex)
        {
            if (m_parent != null)
            {
                m_parent.AddWarning(message, ex);
            }
            else
            {
                Logging.Log.WriteMessage(message, Duplicati.Library.Logging.LogMessageType.Warning, ex);

                var s = ex == null ? message : string.Format("{0} => {1}", message, VerboseErrors ? ex.ToString() : ex.Message);
                m_warnings.Add(s);

                if (MessageSink != null)
                {
                    MessageSink.WarningEvent(message, ex);
                }

                if (m_db != null && !m_db.IsDisposed)
                {
                    LogDbMessage("Warning", message, ex);
                }
            }
        }