Any chance this could be implemented into LINQPad proper? That is, being able to dump to different target output panels, preferably with full support and functionality of the regular output panel.
I have some scripts where I would like to have some processes running in parallel (invoked via Parallel.ForEach()) and output to their own separate panels status and other information and I can freely switch between the panels as they are running. I can kinda simulate it outputting dump containers for each batch but it gets messy trying to view the results from each batch.
Comments
[NLog.Targets.Target("LinqPadPanelTarget")] class LinqPadPanelTarget : NLog.Targets.TargetWithLayout { public string PanelName { get; set; } = "Logging"; protected override void Write(NLog.LogEventInfo log) { string line = Layout.Render(log); line.DumpToPanel(PanelName); } }
static void RedirectNLogToLoggingPanel(NLog.LogLevel minLevel = null, string panelName = null) { var config = NLog.LogManager.Configuration; if (config == null) config = NLog.LogManager.Configuration = new NLog.Config.LoggingConfiguration(); var target = new LinqPadPanelTarget(); if(panelName != null) target.PanelName = panelName; NLog.LogManager.Configuration.AddTarget("linqpad", target); NLog.LogManager.Configuration.AddRule(minLevel ?? NLog.LogLevel.Trace, NLog.LogLevel.Fatal, "linqpad"); NLog.LogManager.ReconfigExistingLoggers(); }
RedirectNLogToLoggingPanel(); Task.WaitAll(Task.Delay(100000000));
await Task.Delay
instead ofTask.WaitAll
(the latter is blocking).Any chance this could be implemented into LINQPad proper? That is, being able to dump to different target output panels, preferably with full support and functionality of the regular output panel.
I have some scripts where I would like to have some processes running in parallel (invoked via
Parallel.ForEach()
) and output to their own separate panels status and other information and I can freely switch between the panels as they are running. I can kinda simulate it outputting dump containers for each batch but it gets messy trying to view the results from each batch.