"use strict";
var IOSSimulatorLogProvider = (function () {
    function IOSSimulatorLogProvider($iOSSimResolver, $deviceLogProvider, $devicePlatformsConstants, $processService) {
        this.$iOSSimResolver = $iOSSimResolver;
        this.$deviceLogProvider = $deviceLogProvider;
        this.$devicePlatformsConstants = $devicePlatformsConstants;
        this.$processService = $processService;
    }
    IOSSimulatorLogProvider.prototype.startLogProcess = function (deviceIdentifier) {
        var _this = this;
        if (!this.isStarted) {
            var deviceLogChildProcess = this.$iOSSimResolver.iOSSim.getDeviceLogProcess(deviceIdentifier);
            var action = function (data) { return _this.$deviceLogProvider.logData(data.toString(), _this.$devicePlatformsConstants.iOS, deviceIdentifier); };
            if (deviceLogChildProcess.stdout) {
                deviceLogChildProcess.stdout.on("data", action);
            }
            if (deviceLogChildProcess.stderr) {
                deviceLogChildProcess.stderr.on("data", action);
            }
            this.$processService.attachToProcessExitSignals(this, deviceLogChildProcess.kill);
            this.isStarted = true;
        }
    };
    return IOSSimulatorLogProvider;
}());
exports.IOSSimulatorLogProvider = IOSSimulatorLogProvider;
$injector.register("iOSSimulatorLogProvider", IOSSimulatorLogProvider);
