/// <summary> /// Continues logging to a file if it already exists or creates it. /// </summary> public static void Resume(string logFile) { #if DEBUG_VERBOSE xLogEngine.Settings.OutputLevel = ELogLevel.All; xLogEngine.Settings.LoggingLevel = ELogLevel.All; #endif string filePath = Finalize_Log_FileName(logFile); try { Stop_Processing(); if (FileConsumer != null) { RemoveConsumer(FileConsumer); FileConsumer.Dispose(); } FileConsumer = new FileLogConsumer(filePath, FileMode.Append); AddConsumer(FileConsumer); Start_Processing(); } catch (Exception ex) { System.Console.WriteLine(CurrentFormatter.Format_Exception(ex)); throw; } Banner(ELogLevel.Info, nameof(xLogEngine), "Resuming Logs"); }
/// <summary> /// Removes a log line consumer from the list of consumers which receive lines output by the logger /// </summary> /// <param name="consumer"></param> public static void RemoveConsumer(ILogLineConsumer consumer) { if (object.ReferenceEquals(consumer, null)) { throw new ArgumentNullException(nameof(consumer)); } lock ( Consumers ) { Consumers.Remove(consumer); } }