improved logging for subs