Skip to content

Commit 797a823

Browse files
Prevent logtail from raising in irb (#9)
* Prevent caller detection from raising * Bump version number
1 parent 356994c commit 797a823

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/logtail/log_entry.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def current_runtime_context
120120

121121
calling_frame_index = last_logger_invocation_index + 1
122122
frame = caller_locations[calling_frame_index]
123+
return {} if frame.nil?
123124

124125
return convert_to_runtime_context(frame)
125126
end
@@ -138,6 +139,8 @@ def logtail_logger_frame?(frame)
138139

139140
def path_relative_to_app_root(frame)
140141
Pathname.new(frame.absolute_path).relative_path_from(root_path).to_s
142+
rescue
143+
frame.absolute_path
141144
end
142145

143146
def root_path

lib/logtail/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Logtail
2-
VERSION = "0.1.5"
2+
VERSION = "0.1.6"
33
end

0 commit comments

Comments
 (0)