use auto-closure trick for debug traces

Trick described in https://developer.apple.com/swift/blog/?id=4.

Also add debuglevel switch.