function logPolicy(options = {}) {
    var _a;
    const logger = (_a = options.logger) !== null && _a !== void 0 ? _a : coreLogger.info;
    const sanitizer = new Sanitizer({
        additionalAllowedHeaderNames: options.additionalAllowedHeaderNames,
        additionalAllowedQueryParameters: options.additionalAllowedQueryParameters
    });
    return {
        name: logPolicyName,
        async sendRequest(request, next) {
            if (!logger.enabled) {
                return next(request);
            }
            logger(`Request: ${sanitizer.sanitize(request)}`);
            const response = await next(request);
            logger(`Response status code: ${response.status}`);
            logger(`Headers: ${sanitizer.sanitize(response.headers)}`);
            return response;
        }
    };
}
/**
 * A policy that logs all requests and responses.
 * @param options - Options to configure logPolicy.
 */
A policy that logs all requests and responses.
@param options - Options to configure logPolicy.
A policy that logs all requests and responses . @param options - Options to configure logPolicy .
function logPolicy(options = {}) {
    var _a;
    const logger = (_a = options.logger) !== null && _a !== void 0 ? _a : coreLogger.info;
    const sanitizer = new Sanitizer({
        additionalAllowedHeaderNames: options.additionalAllowedHeaderNames,
        additionalAllowedQueryParameters: options.additionalAllowedQueryParameters
    });
    return {
        name: logPolicyName,
        async sendRequest(request, next) {
            if (!logger.enabled) {
                return next(request);
            }
            logger(`Request: ${sanitizer.sanitize(request)}`);
            const response = await next(request);
            logger(`Response status code: ${response.status}`);
            logger(`Headers: ${sanitizer.sanitize(response.headers)}`);
            return response;
        }
    };
}
function logPolicy ( options = { } ) { var _a ; const logger = ( _a = options . logger ) !== null && _a !== void 0 ? _a : coreLogger . info ; const sanitizer = new Sanitizer ( { additionalAllowedHeaderNames : options . additionalAllowedHeaderNames , additionalAllowedQueryParameters : options . additionalAllowedQueryParameters } ) ; return { name : logPolicyName , async sendRequest ( request , next ) { if ( ! logger . enabled ) { return next ( request ) ; } logger ( ` ${ sanitizer . sanitize ( request ) } ` ) ; const response = await next ( request ) ; logger ( ` ${ response . status } ` ) ; logger ( ` ${ sanitizer . sanitize ( response . headers ) } ` ) ; return response ; } } ; }
A policy that logs all requests and responses.
A policy that logs all requests and responses .