FinalDestination should only log when verbose is enabled
This commit is contained in:
parent
880d154381
commit
d1f257d275
|
@ -36,7 +36,8 @@ class FileHelper
|
||||||
dest = FinalDestination.new(
|
dest = FinalDestination.new(
|
||||||
url,
|
url,
|
||||||
max_redirects: follow_redirect ? 5 : 1,
|
max_redirects: follow_redirect ? 5 : 1,
|
||||||
skip_rate_limit: skip_rate_limit
|
skip_rate_limit: skip_rate_limit,
|
||||||
|
verbose: verbose
|
||||||
)
|
)
|
||||||
uri = dest.resolve
|
uri = dest.resolve
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ class FinalDestination
|
||||||
@http_verb = @force_get_hosts.any? { |host| hostname_matches?(host) } ? :get : :head
|
@http_verb = @force_get_hosts.any? { |host| hostname_matches?(host) } ? :get : :head
|
||||||
@cookie = nil
|
@cookie = nil
|
||||||
@limited_ips = []
|
@limited_ips = []
|
||||||
|
@verbose = @opts[:verbose] || false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.connection_timeout
|
def self.connection_timeout
|
||||||
|
@ -93,7 +94,7 @@ class FinalDestination
|
||||||
|
|
||||||
if @limit < 0
|
if @limit < 0
|
||||||
@status = :too_many_redirects
|
@status = :too_many_redirects
|
||||||
log(:warn, "FinalDestination could not resolve URL (too many redirects): #{@uri}")
|
log(:warn, "FinalDestination could not resolve URL (too many redirects): #{@uri}") if @verbose
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ class FinalDestination
|
||||||
end
|
end
|
||||||
|
|
||||||
unless validate_uri
|
unless validate_uri
|
||||||
log(:warn, "FinalDestination could not resolve URL (invalid URI): #{@uri}")
|
log(:warn, "FinalDestination could not resolve URL (invalid URI): #{@uri}") if @verbose
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -180,10 +181,10 @@ class FinalDestination
|
||||||
@status = :failure
|
@status = :failure
|
||||||
@status_code = response.status
|
@status_code = response.status
|
||||||
|
|
||||||
log(:warn, "FinalDestination could not resolve URL (status #{response.status}): #{@uri}")
|
log(:warn, "FinalDestination could not resolve URL (status #{response.status}): #{@uri}") if @verbose
|
||||||
nil
|
nil
|
||||||
rescue Excon::Errors::Timeout
|
rescue Excon::Errors::Timeout
|
||||||
log(:warn, "FinalDestination could not resolve URL (timeout): #{@uri}")
|
log(:warn, "FinalDestination could not resolve URL (timeout): #{@uri}") if @verbose
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue