The way I do this is by wrapping the Script-Fu functions to show debugging details, as explained more thoroughly here.
https://script-fu.github.io/funky/hub/tutorials/folder/debugging/debugging/