I have a generic method that accepts a Func<int>
and I would like to log the Func that is passed into the method. What properties are available on the passed in func to help me understand what it is doing?
log4net is one of the most common external logging services available to . NET developers. The developers for log4net promise you can have logging integrated with your application within minutes, and it's true—setup is easy. log4net is available in NuGet, so it's just as easy to install as it is to code.
Logging is the process of recording events in software as they happen in real-time, along with other information such as the infrastructure details, time taken to execute, etc. Logging is an essential part of any software application.
You can log the method name with func.Method.Name
, and there's some other useful properties in the MethodInfo
class. However, if the Func
is anonymous, then you will not get a very helpful name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With