Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loggers #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion lib/azure/core/http/http_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ def initialize(method, uri, options_or_body = {})

self.headers = default_headers(options[:current_time] || Time.now.httpdate).merge(options[:headers] || {})
self.body = options[:body]
message = [
"\n\n\n",
'OBJECT_ID:',
object_id,
"\n\n",
'OPTIONS:',
options,
"\n\n",
'HEADERS:',
self.headers,
"\n\n\n"
].join(' ')
::Logger.new('log/azure_core_info.log').info(message)
end

# Public: Applies a HttpFilter to the HTTP Pipeline
Expand Down Expand Up @@ -150,7 +163,34 @@ def call

response = HttpResponse.new(res)
response.uri = uri
raise response.error if !response.success? && !@has_retry_filter
# raise response.error if !response.success? && !@has_retry_filter
if !response.success? && !@has_retry_filter
message = [
"\n\n\n",
'OBJECT_ID:',
object_id,
"\n\n",
'ERROR:',
response.error,
"\n\n",
'RESPONSE:',
response.inspect,
"\n\n\n"
].join(' ')
::Logger.new('log/azure_core_failure.log').info(message)
raise response.error
else
message = [
"\n\n\n",
'OBJECT_ID:',
object_id,
"\n\n",
'RESPONSE:',
response.inspect,
"\n\n\n"
].join(' ')
::Logger.new('log/azure_core_success.log').info(message)
end
response
end

Expand Down