serilog-contrib / serilog-sinks-richtextbox

A Serilog sink that writes log events to a WPF RichTextBox control with colors and theme support
Apache License 2.0
109 stars 25 forks source link

AutoScroll to the End after each Log entry #21

Closed KayakFisher205 closed 3 years ago

KayakFisher205 commented 3 years ago

I tested the Samples (WinFormsHostNet50Sample, WpfNet50Sample, and WpfNet462Sample) and when the Log reached the bottom of the form, it does not scroll. When I use Serilog to log to the Console, it does. I'm using the Hybrid WPF/Winforms Example (WinFormsHostNet50Sample), so I can't use a trigger or Event (that I know of). If its possible to enable ScrollToEnd() somehow, or give the option to reverse the log (richtextbox.Text="new Log data" + richtextbox.Text), that would put the newest log on the top.

I use the program to monitor alot of processes so it would be helpful to see the most recent output without manually scrolling down.

Epiphrin commented 3 years ago

Hi i have posted @stackoverflow a solution for wpf richtextbox autoscroll. Just replace in stackoverflow code "yourRichtTextBox" with "_richTextBox" from the WpfNet50Sample code,

https://stackoverflow.com/a/69489605/5342618

augustoproiete commented 3 years ago

Moving to GitHub discussions as this is out-of-scope for a Serilog Sink would do