nblumhardt / serilog-timings

Extends Serilog with support for timed operations
Apache License 2.0
218 stars 21 forks source link

Question: Filter timings efficiently #27

Closed Miggleness closed 5 years ago

Miggleness commented 5 years ago

What would be the best way to filter for logs raised by SerilogTimings? I'm replacing my own context execution timer with SerilogTimings. With my own roll, I can filter by the class of my timer.

I have the following code that works but wonder if there's a more efficient way.
.Filter.ByIncludingOnly(Matching.WithProperty("Elapsed"))

nblumhardt commented 5 years ago

Howdy! Thanks for the question. The library's really designed to be a helper for generating regular events, rather than appear as a log source in its own right, so I think your method is probably about right. May be something for us to consider if/when we integrate this kind of functionality into Serilog itself, though! Thanks again.

Miggleness commented 5 years ago

Thanks for the rather quick response. I'll continue using that filter then.