YoutubeAPI: add debug/trace logging

This commit is contained in:
Samantaz Fox 2021-07-26 21:03:28 +02:00
parent 9d2932afdb
commit a1489e6280
No known key found for this signature in database
GPG key ID: F42821059186176E

View file

@ -84,6 +84,15 @@ module YoutubeAPI
def api_key : String
HARDCODED_CLIENTS[@client_type][:api_key]
end
# Convert to string, for logging purposes
def to_s
return {
client_type: self.name,
region: @region,
proxy_region: @proxy_region,
}.to_s
end
end
# Default client config, used if nothing is passed
@ -341,6 +350,11 @@ module YoutubeAPI
"Accept-Encoding" => "gzip",
}
# Logging
LOGGER.debug("YoutubeAPI: Using endpoint: \"#{endpoint}\"")
LOGGER.trace("YoutubeAPI: ClientConfig: #{client_config.to_s}")
LOGGER.trace("YoutubeAPI: POST data: #{data.to_s}")
# Send the POST request
if client_config.proxy_region
response = YT_POOL.client(