Specify error handler for text encoding in logging functions.
Specify error handler for text encoding in logging functions.

Summary: Currently output from build command is decoded with "surrogateescape" error handler, but when writing to log files/stdout we don't specify error handlers to be also "surrogateescape" according to https://docs.python.org/3/library/codecs.html#error-handlers, which could cause exception when there's surrogate characters logged in message.

Reviewed By: yfeldblum

Differential Revision: D21850411

fbshipit-source-id: 21c51d1ab2132171ae29f2d1fbe42655ebee94c5

facebook/watchman,nodakai/watchman,nodakai/watchman,facebook/watchman,nodakai/watchman,nodakai/watchman,nodakai/watchman,nodakai/watchman,facebook/watchman,nodakai/watchman,facebook/watchman,facebook/watchman,facebook/watchman,nodakai/watchman,facebook/watchman,facebook/watchman,nodakai/watchman,facebook/watchman