Skip to content

Commit 6cb064e

Browse files
Always clone tags + fix root_path on older ruby versions (#7)
* Always clone tags so that they are not cleared before the event is pushed to the server * Make sure root path is always an instance of Pathname * Update package version
1 parent 3540041 commit 6cb064e

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

lib/logtail/log_entry.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ def path_relative_to_app_root(frame)
142142

143143
def root_path
144144
if Object.const_defined?('Rails')
145-
Rails.root.to_s
145+
Rails.root
146146
elsif Object.const_defined?('Rack::Directory')
147-
Rack::Directory.new('').root
147+
Pathname.new(Rack::Directory.new('').root)
148148
else
149149
base_file = caller_locations.last.absolute_path
150150
Pathname.new(File.dirname(base_file || '/'))

lib/logtail/logger.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ class Formatter
3434
def build_log_entry(severity, time, progname, logged_obj)
3535
context_snapshot = CurrentContext.instance.snapshot
3636
level = SEVERITY_MAP.fetch(severity)
37-
tags = extract_active_support_tagged_logging_tags
37+
tags = extract_active_support_tagged_logging_tags.clone
3838

3939
if logged_obj.is_a?(Event)
4040
LogEntry.new(level, time, progname, logged_obj.message, context_snapshot, logged_obj,
4141
tags: tags)
4242
elsif logged_obj.is_a?(Hash)
4343
# Extract the tags
44-
tags = tags.clone
4544
tags.push(logged_obj.delete(:tag)) if logged_obj.key?(:tag)
4645
tags.concat(logged_obj.delete(:tags)) if logged_obj.key?(:tags)
4746
tags.uniq!

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.3"
2+
VERSION = "0.1.4"
33
end

0 commit comments

Comments
 (0)