Search code examples
logginglinepostsharp

PostSharp Logging line by line


Does PostSharp support logging each line executed, or just function calls?

I have a program that randomly fails two or three times a week. I want to see the line and related info that the code is failing on. It just dies when it fails, so I will end up seeing the last successful line run. I know Postsharp will log function by function call for me. Will it also do line by line?


Solution

  • No, this is not possible to do that automatically and, in general, I think it would generate huge logs that would be difficult to read.

    The recommended approach in this case is to combine automatic logging on method entry/exit with manual logging at essentials forking points within the offending method -- for instance, add logging inside if and foreach blocks.