Moved GC.KeepAlive
This commit is contained in:
parent
65c8d5ec1b
commit
c0ed689c66
1 changed files with 4 additions and 2 deletions
|
|
@ -25,6 +25,8 @@ public class Logger
|
||||||
/// <returns>A bool stating if the logger was started</returns>
|
/// <returns>A bool stating if the logger was started</returns>
|
||||||
public static void StartLogger(string filePath = "", LoggerObjects.LogLevel level = LoggerObjects.LogLevel.DEBUG, DateTime cleanUpBefore = new DateTime(), bool ThrowOnFailedDeletion = false)
|
public static void StartLogger(string filePath = "", LoggerObjects.LogLevel level = LoggerObjects.LogLevel.DEBUG, DateTime cleanUpBefore = new DateTime(), bool ThrowOnFailedDeletion = false)
|
||||||
{
|
{
|
||||||
|
GC.KeepAlive(_loggerObjects.LogsToPost);
|
||||||
|
|
||||||
if (loggerStarted)
|
if (loggerStarted)
|
||||||
throw new Exception($"The logger is already started");
|
throw new Exception($"The logger is already started");
|
||||||
|
|
||||||
|
|
@ -72,10 +74,10 @@ public class Logger
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
GC.KeepAlive(_loggerObjects.LogsToPost);
|
|
||||||
|
|
||||||
foreach (var b in _loggerObjects.LogsToPost.ToList())
|
foreach (var b in _loggerObjects.LogsToPost.ToList())
|
||||||
{
|
{
|
||||||
|
GC.KeepAlive(b);
|
||||||
|
|
||||||
string LogLevelText = b.LogLevel.ToString();
|
string LogLevelText = b.LogLevel.ToString();
|
||||||
ConsoleColor LogLevelColor = ConsoleColor.Gray;
|
ConsoleColor LogLevelColor = ConsoleColor.Gray;
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue