Integrated debuggers are wonderful. However, sometimes they get in the way. Old school “print outs” are a simple tool for figuring out what the code is really doing.

Here are examples for displaying the current function and an object.

Unity3D C#:

  • print (“DEBUG ” + myObject.myAttribute)
  • Note: to get all the attributes from myObject, will need to loop them

Objective-C:

  • NSLog(@”%s”, __FUNCTION__);
  • NSLog(@”%@”, myObject);

Javascript:

  • console.log(JSON.stringify(dto));

Java:

  • Log.i(“dev”, new Exception().getStackTrace()[0].toString());
  • Log.i(“dev”, myObject.toString());
  • Note: In Java, your object (or its parent) may need a toString() method.

PHP:

  • echo __FUNCTION__;
  • echo “<pre>” . print_r($myObject, true) . “</pre>”;