Method: Logtail::LogDevices::HTTP#verify_delivery!

Defined in:
lib/logtail/log_devices/http.rb

#verify_delivery!Object



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/logtail/log_devices/http.rb', line 147

def verify_delivery!
  5.times do |i|
    sleep(2)

    if @last_resp.nil?
      print "."
    elsif @last_resp.code == "202"
      puts "Log delivery successful! View your logs at https://logtail.com"
    else
      raise "\nLog delivery failed!\n\nStatus: \#{@last_resp.code}\nBody: \#{@last_resp.body}\n\nYou can enable internal Logtail debug logging with the following:\n\nLogtail::Config.instance.debug_logger = ::Logger.new(STDOUT)\n"
    end
  end

  raise "\nLog delivery failed! No request was made.\n\nYou can enable internal debug logging with the following:\n\nLogtail::Config.instance.debug_logger = ::Logger.new(STDOUT)\n"
end