Generic debug code nicely encapsulated!