How to best add logging/debugging code?