using System; using System.Collections.Generic; using System.CommandLine; using System.CommandLine.Invocation; using System.CommandLine.IO; using System.CommandLine.Rendering; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CustomHostingDemo { public interface ILog { void LogMessage(string msg); } public class Log : ILog { private readonly IConsole _console; public Log(InvocationContext context) { _console = context.Console; } public void LogMessage(string msg) { _console.Out.WriteLine(new ContainerSpan( ForegroundColorSpan.LightBlue(), new ContentSpan(msg), ForegroundColorSpan.Reset() ).ToString(OutputMode.Ansi)); } } }