serilog-sinks-richtextbox icon indicating copy to clipboard operation
serilog-sinks-richtextbox copied to clipboard

Consider using multiple paragraphs instead of multiple inlines in a single paragraph

Open augustoproiete opened this issue 2 years ago • 6 comments

Currently, each new log entry appends a corresponding Inline object to the last Paragraph in the RichTextBox.

One user reported that writing log entries creating multiple paragraphs seem to have a better performance than creating multiple inlines in a single paragraph once the number of entries is large (the example was ~6000 lines with 4-5 tokens in each entry).

If that is true (needs testing/PoC), then it probably makes sense to switch to using multiple paragraphs by default.

One downside of using multiple paragraphs is that by default the control appends a margin which visually looks like each entry is using two lines instead of one, thus the user would have to remove the default margin of the control:

<Style TargetType="{x:Type Paragraph}">
    <Setter Property="Margin" Value="0"/>
</Style>

I don't think the sink should be making any changes to the visual aspects of the RichTextBox control, thus if we go this route, we should document the margin issue above

augustoproiete avatar Aug 07 '21 23:08 augustoproiete

Hi @augustoproiete - Can I pay you to roll in this enhancement and a few others:

  1. If a URL is logged, please convert it to a clickable HyperLink
  2. Related to the above, add an option to auto-trim the text box. If, after writing, a log entry, the text box has more than X number of paragraphs, remove the first items from the text box until there are less than X.

TonyValenti avatar Sep 03 '21 15:09 TonyValenti

@TonyValenti Very interesting ideas. Tracking via https://github.com/serilog-contrib/serilog-sinks-richtextbox/issues/15 and https://github.com/serilog-contrib/serilog-sinks-richtextbox/issues/16 to discuss design. They could potentially be done independently of this issue though definitely related

augustoproiete avatar Sep 04 '21 17:09 augustoproiete

Any chance you could give me a quote on getting this work done?

TonyValenti avatar Sep 04 '21 17:09 TonyValenti

@augustoproiete ?

TonyValenti avatar Sep 08 '21 14:09 TonyValenti

We are having performance problems with longer running apps because this is not implemented. Any chance you can make it happen soon?

TonyValenti avatar Oct 18 '21 11:10 TonyValenti

@TonyValenti I'll see if I can block some time over the next few weeks, but happy to take a PR if you'd like to give it a go

augustoproiete avatar Oct 18 '21 23:10 augustoproiete

Any update for this?

c0nstexpr avatar Jun 18 '24 08:06 c0nstexpr

I have code that does this and makes the library much more performant but the manager has stopped replying.

TonyValenti avatar Jun 18 '24 10:06 TonyValenti

https://github.com/serilog-contrib/serilog-sinks-richtextbox/issues/32

TonyValenti avatar Jun 18 '24 10:06 TonyValenti