Caller Information
It is now easier from C# 5.0 onwards to get the log information in case of any error occurs with the help of .net framework.
We can use System.Runtime.CompilerServices namespace to log the error and method information. Some of the important
attributes to use are : CallerFilePath, CallerLineNumber and CallerMemberName.
Example:
Output :
No comments:
Post a Comment