add debug() function
Merge pull request #1719 from vanbogithub/bfan-next

add debug() function