/// <summary>
        /// Adds a log writer and binds to a specific log message type
        /// </summary>
        /// <param name="logMessageType">Type of log message</param>
        /// <param name="logWriter">Log writer to add</param>
        public void AddLogWriter(NiawaLogType logMessageType, ILogWriter logWriter)
        {
            //Ensure that more than one instance of a ILogWriter implementation (of a specific type) is not added.
            if(_logWriters.ContainsKey(logWriter.GetType().ToString()))
                if (_logWriters[logWriter.GetType().ToString()].LogWriterID != logWriter.LogWriterID)
                    throw new Exception("Cannot add two instances of the same ILogWriter type [" + logWriter.GetType().ToString() + "].  Add a different type of ILogWriter, or add an existing instance of this ILogWriter type.");

             //Check for duplicate entry attempts into the LogMessageTypeLogWriters collection
            if (_logMessageTypeLogWriters.ContainsKey(logMessageType))
                if (_logMessageTypeLogWriters[logMessageType].Contains(logWriter))
                    throw new Exception("Cannot add the same ILogWriter [" + logWriter.GetType().ToString() + "] for LogMessageType [" + Enum.GetName(logMessageType.GetType(), logMessageType) + "] more than once.");

            //add log writer to list
            if (!(_logWriters.ContainsKey(logWriter.GetType().ToString())))
                _logWriters.Add(logWriter.GetType().ToString(), logWriter);

            //add log writer to map
            List<ILogWriter> mapLogWriters = null;

            //check if log message type already in map
            if (_logMessageTypeLogWriters.ContainsKey(logMessageType))
                mapLogWriters = _logMessageTypeLogWriters[logMessageType];
            else
            {
                //create new entry of log writers for log message type and add to map
                mapLogWriters = new List<ILogWriter>();
                _logMessageTypeLogWriters.Add(logMessageType, mapLogWriters);
            }

            //add log writer to list of log writers mapped to log message type
            mapLogWriters.Add(logWriter);
        }
 public NiawaLogMessage(DateTime logDate
     , NiawaLogType logType
     , string logMessage
     , Exception logException)
 {
     LogDate = logDate;
     LogType = logType;
     LogMessage = logMessage;
     LogException = logException;
 }
 public void Log(NiawaLogType logType, string logMessage)
 {
     Log(logType, logMessage, null);
 }
 /// <summary>
 /// Add log message to be written asynchronously
 /// </summary>
 /// <param name="logType">Log message type</param>
 /// <param name="logMessage">Log message text</param>
 /// <param name="logException">Log exception, if any</param>
 public void Log(NiawaLogType logType, string logMessage, Exception logException)
 {
     //enqueue only if at least one log writer is mapped for this log message type
     if (_logMessageTypeLogWriters.ContainsKey(logType))
         _messages.Enqueue(new NiawaLogMessage(DateTime.Now, logType, logMessage, logException));
 }