#region  --------------- Copyright Dresser Wayne Pignone -------------
/*
 * $Log: /Wrk/WayneLibraries/Wrk/Log/LogException.cs $
 * 
 * 2     08-02-13 9:28 Mattias.larsson
 * FxCop fixes.
 */
#endregion

using System;

namespace Wayne.Lib.Log
{
    /// <summary>
    /// General log exception.
    /// </summary>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable")]
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")]
    public class LogException : Exception
    {
        #region Fields

        private LogExceptionType type;

        #endregion

        #region Construction

        /// <summary>
        /// Construction.
        /// </summary>
        public LogException(LogExceptionType type)
        {
            this.type = type;
        }

        /// <summary>
        /// Construction.
        /// </summary>
        public LogException(LogExceptionType type, string message)
            : base(message)
        {
            this.type = type;
        }

        /// <summary>
        /// Construction.
        /// </summary>
        public LogException(LogExceptionType type, string message, Exception inner)
            : base(message, inner)
        {
            this.type = type;
        }

        #endregion

        #region Properties

        /// <summary>
        /// The type of exception.
        /// </summary>
        public LogExceptionType LogExceptionType
        {
            get { return type; }
        }

        #endregion

        #region Methods

        /// <summary>
        /// The Message
        /// </summary>
        public override string Message
        {
            get
            {
                return string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}: \"{1}\"", type, base.Message);
            }
        }

        /// <summary>
        /// ToString.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return string.Format(System.Globalization.CultureInfo.InvariantCulture, "LogException({0}){1}", type, base.ToString());
        }

        #endregion
    }
}