Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any libraries out there that extend System.Diagnostics.Trace?

Any there any good libraries out there that extend System.Diagnostics.Trace?

Some of the features I am looking for.

  • Rolling logs
  • smtp

And "Use log4net" is not an answer. The reason being is that i don't want a reference to any third party assemblies.

In response to comments: Because using trace does not pollute the business code. I only call Trace.XXX. Using an extension to Trace can be done in config or a small amount of code at startup. If I use log4net is need references to it everywhere.

like image 211
Simon Avatar asked Jan 23 '23 02:01

Simon


1 Answers

You might also check out Ukadc.Diagnostics here

It contains several TraceListeners. More interestingly, it adds the ability to use formatting statements (like what log4net and NLog support). So, you have much more control over the layout of your logfile, including which fields are logged, the ordering of the fields, formatting of at least some of the fields (like data/time formatting). You can even write your own "tokens" and then reference them in the formatting statements. It does not support nearly as many formatting options as log4net or NLog and also does not support nearly the number of TraceListeners, but, for a System.Diagnostics-based solution, it is a real step up from the "out of the box" capabilities available in System.Diagnostics.

like image 144
wageoghe Avatar answered Feb 16 '23 01:02

wageoghe