in src/Common/Commands.Common/PowerBILogger.cs [189:221]
public void WriteHost(object obj, ConsoleColor? foregroundColor = null, ConsoleColor? backgroundColor = null)
{
if (this.OnDifferentThread)
{
var hostMessage = new Tuple<object, ConsoleColor?, ConsoleColor?>(obj, foregroundColor, backgroundColor);
this.hostQueue.Enqueue(hostMessage);
}
else if (this.CommandRuntimeAvailable && this.Cmdlet.Host?.UI != null)
{
if (foregroundColor == null && backgroundColor == null)
{
this.Cmdlet.Host.UI.WriteLine(obj.ToString());
}
else
{
if(foregroundColor == null)
{
foregroundColor = this.Cmdlet.Host.UI.RawUI.ForegroundColor;
}
if(backgroundColor == null)
{
backgroundColor = this.Cmdlet.Host.UI.RawUI.BackgroundColor;
}
this.Cmdlet.Host.UI.WriteLine(foregroundColor.Value, backgroundColor.Value, obj.ToString());
this.HostListener?.Invoke(obj);
}
}
Trace.Write("[HOST]:: ");
Trace.WriteLine(obj);
}