Replies: 2 comments 1 reply
|
Just found something that works... I created a new logger which logs to // get text write from SC.L
using var writer = context.Console.Error.CreateTextWriter();
// create new Spectre logger, just for stderr
var errConsole = AnsiConsole.Create(new AnsiConsoleSettings {
Ansi = console.Profile.Capabilities.Ansi ? AnsiSupport.Yes : AnsiSupport.Detect,
ColorSystem = (ColorSystemSupport)console.Profile.Capabilities.ColorSystem,
//Enrichment = ??? (***)
//EnvironmentVariables = ??? (***)
ExclusivityMode = console.ExclusivityMode,
Interactive = console.Profile.Capabilities.Interactive ? InteractionSupport.Yes : InteractionSupport.Detect,
Out = new AnsiConsoleOutput(writer),
// ...what else to do here? (***)
});
console.MarkupLine("[green]stdout[/]");
errConsole.MarkupLine("[red]stderr[/]");Test: $ myapp # prints both in colour
$ myapp 1>/dev/null # prints red 'stderr'
$ myapp 2>/dev/null # prints green 'stdout'..."Works for me", on my terminal.
|
0 replies
|
Hmmm, not 100% sure what the SC.L is referring too. If it is a logging nuget package out there, we don't own that so this might be better suited asking that package owner. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I'm using a third-party console tool (System.CommandLine), with SpectreConsole for logging (obviously... there's nothing quite like it).
I want to write error messages to
stdout. I can do that with SC.L, but not when I combine both libraries. The closest I found was this issue but I'm unsure how to use the info there practically.I'm assuming there are other people who use these two together - do you have any working code or tips to share?
All reactions