/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Tools/RunTests/ConsoleUtil.cs
73 строки
2 KB
Jared Parsons
Emit AzDo error with helix job ID on test timeout (#83776)
19 май 2026, 21:45
Не верифицирован
19 май 2026, 21:45
3eec8c0
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; namespace RunTests { /// <summary> /// Used to write out to the Console. In addition to writing to the console this will output the same messages /// to our log file. This ensures the log file can be used as our single point of diagnostics. /// </summary> internal static class ConsoleUtil { internal static void Write(string message) { Console.Write(message); Logger.Log(message + Environment.NewLine); } internal static void WriteLine() { Console.WriteLine(); Logger.Log(""); } internal static void Warning(string message) { Console.Write("##vso[task.logissue type=warning]"); Console.WriteLine(message); Logger.LogWarning(message); } internal static void Error(string message) { Console.Write("##vso[task.logissue type=error]"); Console.WriteLine(message); Logger.Log($"ERROR: {message}"); } internal static void WriteLine(string message) { Console.WriteLine(message); Logger.Log(message); } internal static void Write(ConsoleColor color, string message) { WithColor(color, () => Write(message)); } internal static void WriteLine(ConsoleColor color, string message) { WithColor(color, () => WriteLine(message)); } private static void WithColor(ConsoleColor color, Action action) { var saved = Console.ForegroundColor; try { Console.Out.Flush(); Console.ForegroundColor = color; action(); Console.Out.Flush(); } finally { Console.ForegroundColor = saved; } } } }