/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Logger = require('./logger');
var logger = Logger.logger;
var debugSession_1 = require('./debugSession');
var LoggingDebugSession = (function (_super) {
    __extends(LoggingDebugSession, _super);
    function LoggingDebugSession(_logFilePath, obsolete_debuggerLinesAndColumnsStartAt1, obsolete_isServer) {
        _super.call(this, obsolete_debuggerLinesAndColumnsStartAt1, obsolete_isServer);
        this._logFilePath = _logFilePath;
    }
    LoggingDebugSession.prototype.start = function (inStream, outStream) {
        var _this = this;
        _super.prototype.start.call(this, inStream, outStream);
        logger.init(function (e) { return _this.sendEvent(e); }, this._logFilePath, this._isServer);
    };
    /**
     * Overload sendEvent to log
     */
    LoggingDebugSession.prototype.sendEvent = function (event) {
        if (!(event instanceof Logger.LogOutputEvent)) {
            // Don't create an infinite loop...
            logger.verbose("To client: " + JSON.stringify(event));
        }
        _super.prototype.sendEvent.call(this, event);
    };
    /**
     * Overload sendRequest to log
     */
    LoggingDebugSession.prototype.sendRequest = function (command, args, timeout, cb) {
        logger.verbose("To client: " + JSON.stringify(command) + "(" + JSON.stringify(args) + "), timeout: " + timeout);
        _super.prototype.sendRequest.call(this, command, args, timeout, cb);
    };
    /**
     * Overload sendResponse to log
     */
    LoggingDebugSession.prototype.sendResponse = function (response) {
        logger.verbose("To client: " + JSON.stringify(response));
        _super.prototype.sendResponse.call(this, response);
    };
    LoggingDebugSession.prototype.dispatchRequest = function (request) {
        logger.verbose("From client: " + request.command + "(" + JSON.stringify(request.arguments) + ")");
        _super.prototype.dispatchRequest.call(this, request);
    };
    return LoggingDebugSession;
}(debugSession_1.DebugSession));
exports.LoggingDebugSession = LoggingDebugSession;
//# sourceMappingURL=data:application/json;base64,[encoded data, 4956 characters]