SimpleLogger.SimpleLog.Enqueue C# (CSharp) Method

Enqueue() private static method

Enqueue log entry to be written to log file
When StartExplicitly is set to false (which is the default), logging is started automatically by calling StartLogging from inside this method when the first logEntry is enqueued. When StartExplicitly is set to true, logEntry is just enqueued, but not yet actually written to the log file. The latter will be done when StartLogging is called explicitly.
private static Enqueue ( System.Xml.Linq.XElement logEntry ) : void
logEntry System.Xml.Linq.XElement The log entry to be enqueued
return void
        private static void Enqueue(XElement logEntry)
        {
            // Start logging if not already started, unless it is desired to start it explicitly
            if(!StartExplicitly)
                StartLogging();

            lock(_logEntryQueue)
            {
                // Stop enqueueing when stop request was set or when the queue gets too full.
                if(!StopLoggingRequested && _logEntryQueue.Count < 10000)
                    _logEntryQueue.Enqueue(logEntry);
            }
        }