SimpleLogger.SimpleLog.StartLogging C# (CSharp) Method

StartLogging() public static method

Start logging
Start background task pointing to WriteLogEntriesToFile to write log files to disk. Is called automatically by Enqueue when the first entry is logged, unless StartExplicitly is set to true (default is false). Then, this method has to be called explicitly to start logging.
public static StartLogging ( ) : void
return void
        public static void StartLogging()
        {
            // Task already started
            if(_backgroundTask != null || StopLoggingRequested)
                return;

            // Reset stopping flag
            StopLoggingRequested = false;

            lock(_backgroundTaskSyncRoot)
            {
                if(_backgroundTask != null)
                    return;

                // Reset last exception
                LastExceptionInBackgroundTask = null;

                // Create and start task
                _backgroundTask = new Task(WriteLogEntriesToFile, TaskCreationOptions.LongRunning);
                _backgroundTask.Start();
            }
        }