import { HttpOperationResponse } from "../httpOperationResponse" ; import { HttpPipelineLogger } from "../httpPipelineLogger" ; import { HttpPipelineLogLevel } from "../httpPipelineLogLevel" ; import { WebResourceLike } from "../webResource" ; /**
 * Creates a new RequestPolicy per-request that uses the provided nextPolicy.
 */ export type RequestPolicyFactory = { create ( nextPolicy , options ) : RequestPolicy ; } ; export interface RequestPolicy { sendRequest ( httpRequest ) : Promise < HttpOperationResponse > ; } export abstract class BaseRequestPolicy implements RequestPolicy { protected constructor ( readonly _nextPolicy , readonly _options ) { } public abstract sendRequest ( webResource ) ; param logLevel returns public shouldLog ( logLevel ) { return this . _options . shouldLog ( logLevel ) ; } param logLevel param message public log ( logLevel , message ) { this . _options . log ( logLevel , message ) ; } } /**
 * Optional properties that can be used when creating a RequestPolicy.
 */ export interface RequestPolicyOptionsLike { param logLevel returns shouldLog ( logLevel ) : boolean ; param logLevel param message log ( logLevel , message ) : void ; } /**
 * Optional properties that can be used when creating a RequestPolicy.
 */ export class RequestPolicyOptions implements RequestPolicyOptionsLike { constructor ( private _logger ? ) { } param logLevel returns public shouldLog ( logLevel ) { return ( ! ! this . _logger && logLevel !== HttpPipelineLogLevel . OFF && logLevel <= this . _logger . minimumLogLevel ) ; } param logLevel param message public log ( logLevel , message ) { if ( this . _logger && this . shouldLog ( logLevel ) ) { this . _logger . log ( logLevel , message ) ; } } }