I've been doing a few code reviews this week and think I have one common comment for all of them - "Please log the <<thing>> that you just did."

The (pseudo) code typically looks like this:

Regkey myKey = some regkey I want to set

Log.WriteToLog("I am going to set rekey == " + mykey)

SetCurrentUserKey (myKey) //we have a wrapper for setting most of the registry keys just to make life easier

If (SetCurrentUserKey != error)

    Log.WriteToLog("Successfully set key")

Else

    TestFailed

And my comment has typically been to change that final log statement to

Log.WriteToLog("Successfully set key " + myKey)

Yes, I know this is redundant and the lines will be very close together in the logs. But it makes debugging a tiny bit easier later and that is worth it to me.

But I make this comment all the time and wonder if I'm just starting to sound like a broken record saying "Log everything!"  The end result – easier to debug logs when the test hits errors – will be worth it, though. 

Questions, comments, concerns and criticisms always welcome,

John