Categories
.Net Useful Code

Log errors into log files

When logging errors it is always useful to include the function that generate the error and the name of the file containing that function. However hardcoding the file name and function name in the error message, could be a lot of pain excpesially in a big project. So, here is one way to implement this in ASP.NET with C# by calling a function which gets the meta data about the function name and the files name and even the line number of the error 🙂