Change debug logging to use debuglog module