Escape new lines and quotes for teamcity

Teamcity requires line breaks and single quotes to be escaped, see http://confluence.jetbrains.com/display/TCD8/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages.

This commit adds escaping to the grunt log.