public static async Task SaveAsync() { if (logHandler != null) { var sb = new StringBuilder(); foreach (var logMessage in messages) { sb.AppendLine(logMessage.ToString()); } await logHandler.SaveAsync(Filename, sb.ToString()); } messages.Clear(); }