lib/logtail/log_entry.rb in logtail-0.1.5 vs lib/logtail/log_entry.rb in logtail-0.1.6
- old
+ new
@@ -118,10 +118,11 @@
last_logger_invocation_index = caller_locations.rindex { |frame| logtail_logger_frame?(frame) }
return {} if last_logger_invocation_index.nil?
calling_frame_index = last_logger_invocation_index + 1
frame = caller_locations[calling_frame_index]
+ return {} if frame.nil?
return convert_to_runtime_context(frame)
end
def convert_to_runtime_context(frame)
@@ -136,9 +137,11 @@
!frame.absolute_path.nil? && frame.absolute_path.end_with?(LOGGER_FILE)
end
def path_relative_to_app_root(frame)
Pathname.new(frame.absolute_path).relative_path_from(root_path).to_s
+ rescue
+ frame.absolute_path
end
def root_path
if Object.const_defined?('Rails')
Rails.root