diff --git a/osu.Framework/Logging/Logger.cs b/osu.Framework/Logging/Logger.cs index d35f536d2a..32731b8012 100644 --- a/osu.Framework/Logging/Logger.cs +++ b/osu.Framework/Logging/Logger.cs @@ -302,8 +302,6 @@ private void add(string message = @"", LogLevel level = LogLevel.Verbose, Except if (!Enabled || level < Level) return; - ensureHeader(); - logCount.Value++; message = ApplyFilters(message); @@ -394,6 +392,17 @@ private void writePendingLines() using (var stream = Storage.GetStream(Filename, FileAccess.Write, FileMode.Append)) using (var writer = new StreamWriter(stream)) { + if (!headerAdded) + { + writer.WriteLine("----------------------------------------------------------"); + writer.WriteLine($"{Name} Log for {UserIdentifier} (LogLevel: {Level})"); + writer.WriteLine($"Running {GameIdentifier} {VersionIdentifier} on .NET {Environment.Version}"); + writer.WriteLine($"Environment: {RuntimeInfo.OS} ({Environment.OSVersion}), {Environment.ProcessorCount} cores "); + writer.WriteLine("----------------------------------------------------------"); + + headerAdded = true; + } + foreach (string line in lines) writer.WriteLine(line); } @@ -435,19 +444,6 @@ private static void cycleLogs() } } - private void ensureHeader() - { - if (headerAdded) return; - - headerAdded = true; - - add("----------------------------------------------------------", outputToListeners: false); - add($"{Name} Log for {UserIdentifier} (LogLevel: {Level})", outputToListeners: false); - add($"Running {GameIdentifier} {VersionIdentifier} on .NET {Environment.Version}", outputToListeners: false); - add($"Environment: {RuntimeInfo.OS} ({Environment.OSVersion}), {Environment.ProcessorCount} cores ", outputToListeners: false); - add("----------------------------------------------------------", outputToListeners: false); - } - private static readonly List filters = new List(); private static readonly Dictionary static_loggers = new Dictionary();