Is there a way to 'echo' commands from the UI?

As the title suggests; is there a way to echo or output the python command that is used when clicking on an extension button or event?

My point of reference is Autodesk MAYA. Basically you could turn on the echo command for MEL or Python, and every time anything was pressed, the console would show the command. This is really helpful for figuring out, for example, how to add a material or collision to a body, or when changing the position, what the command is to move that specific object. Likewise, creating a scene using the UI, and then aggregating these commands to recreate the scene in a script.

The demos are pretty helpful for seeing whats possible, but they aren’t really written (commented) like a tutorial explaining each action, and between different demos it seems similar things are done with different APIs.