Permalink
Cannot retrieve contributors at this time
35 lines (35 sloc)
1.41 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/@azure/ms-rest-js/es/lib/policies/logPolicy.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) Microsoft Corporation. All rights reserved. | |
// Licensed under the MIT License. See License.txt in the project root for license information. | |
import { __extends } from "tslib"; | |
import { BaseRequestPolicy, } from "./requestPolicy"; | |
export function logPolicy(logger) { | |
if (logger === void 0) { logger = console.log; } | |
return { | |
create: function (nextPolicy, options) { | |
return new LogPolicy(nextPolicy, options, logger); | |
}, | |
}; | |
} | |
var LogPolicy = /** @class */ (function (_super) { | |
__extends(LogPolicy, _super); | |
function LogPolicy(nextPolicy, options, logger) { | |
if (logger === void 0) { logger = console.log; } | |
var _this = _super.call(this, nextPolicy, options) || this; | |
_this.logger = logger; | |
return _this; | |
} | |
LogPolicy.prototype.sendRequest = function (request) { | |
var _this = this; | |
return this._nextPolicy.sendRequest(request).then(function (response) { return logResponse(_this, response); }); | |
}; | |
return LogPolicy; | |
}(BaseRequestPolicy)); | |
export { LogPolicy }; | |
function logResponse(policy, response) { | |
policy.logger(">> Request: " + JSON.stringify(response.request, undefined, 2)); | |
policy.logger(">> Response status code: " + response.status); | |
var responseBody = response.bodyAsText; | |
policy.logger(">> Body: " + responseBody); | |
return Promise.resolve(response); | |
} | |
//# sourceMappingURL=logPolicy.js.map |