Centralize logging and escape message. Fixes #117.