/// <summary> /// The single instance method that writes to the log file /// </summary> /// <param name="message">The message to write to the log</param> public void WriteToLog(LogMessageType msgtype, string message) { // Lock the queue while writing to prevent contention for the log file lock (logQueue) { // Create the entry and push to the Queue Log logEntry = new Log(String.Format(DateTime.Now.ToString() + ": {0} - {1}", msgtype.GetDescription(), message)); logQueue.Enqueue(logEntry); // If we have reached the Queue Size then flush the Queue if (logQueue.Count >= queueSize || DoPeriodicFlush()) { FlushLog(); } } }