#region  --------------- Copyright Dresser Wayne Pignone -------------
/*
 * $Log: /Wrk/WayneLibraries/Wrk/Log/ExternalLogWriter.cs $
 * 
 * 3     08-02-26 13:23 Mattias.larsson
 * Corrected the method-summaries.
 * 
 * 2     08-02-15 10:17 Mattias.larsson
 * Changed the interface to an abstract class.
 */
#endregion

using System.Collections.Generic;
namespace Wayne.Lib.Log
{
    /// <summary>
    /// Interface to an external log writer
    /// </summary>
    public abstract class ExternalLogWriter
    {
        #region Properties

        /// <summary>
        /// Identifies the type of external log writer used in the configuration.
        /// </summary>
        public abstract string ExternalLogType { get; }

        /// <summary>
        /// Identifies the external log writer used in the configuration.
        /// </summary>
        public abstract string ExternalLogName { get; }

        /// <summary>
        /// Tells whether the log writer is currently active.
        /// </summary>
        public abstract bool Active { get; }

        #endregion

        #region Methods

        internal void InitParametersInternal(Dictionary<string, string> dictionary)
        {
            InitParameters(dictionary);
        }

        internal void LogInternal(LogEntry logEntry, string formattedText)
        {
            Log(logEntry, formattedText);
        }

        /// <summary>
        /// Get the LogTextWritingParameters.
        /// </summary>
        /// <returns>Returns the LogTextWritingParameters.</returns>
        protected LogTextWritingParameters GetExternalLoggerWritingParameters()
        {
            return null; // Logger.GetExternalLoggerWritingParameters(this);
        }

        /// <summary>
        /// Called once just before the first log entry.
        /// </summary>
        /// <param name="dictionary">The Param-nodes from the XML-config file</param>
        protected abstract void InitParameters(Dictionary<string, string> dictionary);

        /// <summary>
        /// Called when a log entry should be handled by this external log writer.
        /// </summary>
        /// <param name="logEntry">The LogEntry to log.</param>
        /// <param name="formattedText">The LogEntry as a formatted string.</param>
        protected abstract void Log(LogEntry logEntry, string formattedText);

        #endregion
    }
}