Output explain info in script

Hi, is it possible to output explain info from a groovy script?
Basically I have a potentially complex script and I'd like to generate as much debug information as I can.

Thanks

I know this can make working with scripts very painful but I don't think we have a good solution to that.