"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const common_tags_1 = require("common-tags");
const most = require("most");
const prettyMilliseconds = require("pretty-ms");
const formatWarn_1 = require("./utils/formatWarn");
exports.default = (requestRetry$) => {
    return requestRetry$
        .map((log) => {
        const retriesLeft = log.maxRetries - log.attempt + 1;
        const errorCode = log.error['httpStatusCode'] || log.error['status'] || log.error['errno'] || log.error['code'];
        const msg = common_tags_1.oneLine `${log.method} ${log.url} error (${errorCode}).
        Will retry in ${prettyMilliseconds(log.timeout, { verbose: true })}.
        ${retriesLeft} retries left.`;
        return most.of({ msg: formatWarn_1.default(msg) });
    });
};
//# sourceMappingURL=reportRequestRetry.js.map