Often when I develop a program I throw some console.writeline statements to let me know what the application is doing during debugging. Often time I find myself removing them and adding them back in in order to keep the code clean. I haven’t found a seemingly efficient way to place these gracefully in the code.
I was wondering what other people do or what is considered a best practice for this. I am not sure if I can use trace or not because I am not debugging on a computer with Visual Studio installed (the server I am publishing to does not have it).
Is there any AOP based method to attack this? Ideally I would not want the output in production code because writing to the console seems to slow down the application.
Thanks in advance!
Have you looked at using Log4Net? It should be a lot more flexible for you. You can leave a lot of logging in the code, and turn it on or off based on a configuration loaded at execution time.