logtail 0.1.3 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/logtail/log_entry.rb +6 -3
- data/lib/logtail/logger.rb +3 -3
- data/lib/logtail/version.rb +1 -1
- data/spec/logtail/log_entry_spec.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bb7693b6aa0c18cdfd743e711bbfb2a07d21e580e3698d9c361a4501aed76a8
|
4
|
+
data.tar.gz: 48b28d5a283ce2fb97221dc9d940f4443ece4f576a6bfa8ddceb0fc8321233bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 646bc1896d44fa7704355a9426921a35eda9d34e0f80f8aaa7e35d91adc78fa51ab39fbde249b8835f6045720d6260b08c9687964072c9562dad4053720a9804
|
7
|
+
data.tar.gz: a13480d4db23662178079edd858cf0ceb0fe33f90bdfc5acb178aadc2187e5ee5634b58ac7c5cc6a7c14fcbd367b32f58fa187d9687e22a0741a02ff9121791a
|
data/CHANGELOG.md
CHANGED
data/lib/logtail/log_entry.rb
CHANGED
@@ -120,6 +120,7 @@ module Logtail
|
|
120
120
|
|
121
121
|
calling_frame_index = last_logger_invocation_index + 1
|
122
122
|
frame = caller_locations[calling_frame_index]
|
123
|
+
return {} if frame.nil?
|
123
124
|
|
124
125
|
return convert_to_runtime_context(frame)
|
125
126
|
end
|
@@ -128,7 +129,7 @@ module Logtail
|
|
128
129
|
{
|
129
130
|
file: path_relative_to_app_root(frame),
|
130
131
|
line: frame.lineno,
|
131
|
-
frame_label: frame.label,
|
132
|
+
frame_label: frame.label.dup.force_encoding('UTF-8'),
|
132
133
|
}
|
133
134
|
end
|
134
135
|
|
@@ -138,13 +139,15 @@ module Logtail
|
|
138
139
|
|
139
140
|
def path_relative_to_app_root(frame)
|
140
141
|
Pathname.new(frame.absolute_path).relative_path_from(root_path).to_s
|
142
|
+
rescue
|
143
|
+
frame.absolute_path
|
141
144
|
end
|
142
145
|
|
143
146
|
def root_path
|
144
147
|
if Object.const_defined?('Rails')
|
145
|
-
Rails.root
|
148
|
+
Rails.root
|
146
149
|
elsif Object.const_defined?('Rack::Directory')
|
147
|
-
Rack::Directory.new('').root
|
150
|
+
Pathname.new(Rack::Directory.new('').root)
|
148
151
|
else
|
149
152
|
base_file = caller_locations.last.absolute_path
|
150
153
|
Pathname.new(File.dirname(base_file || '/'))
|
data/lib/logtail/logger.rb
CHANGED
@@ -34,14 +34,13 @@ module Logtail
|
|
34
34
|
def build_log_entry(severity, time, progname, logged_obj)
|
35
35
|
context_snapshot = CurrentContext.instance.snapshot
|
36
36
|
level = SEVERITY_MAP.fetch(severity)
|
37
|
-
tags = extract_active_support_tagged_logging_tags
|
37
|
+
tags = extract_active_support_tagged_logging_tags.clone
|
38
38
|
|
39
39
|
if logged_obj.is_a?(Event)
|
40
40
|
LogEntry.new(level, time, progname, logged_obj.message, context_snapshot, logged_obj,
|
41
41
|
tags: tags)
|
42
42
|
elsif logged_obj.is_a?(Hash)
|
43
43
|
# Extract the tags
|
44
|
-
tags = tags.clone
|
45
44
|
tags.push(logged_obj.delete(:tag)) if logged_obj.key?(:tag)
|
46
45
|
tags.concat(logged_obj.delete(:tags)) if logged_obj.key?(:tags)
|
47
46
|
tags.uniq!
|
@@ -56,7 +55,8 @@ module Logtail
|
|
56
55
|
|
57
56
|
# Because of all the crazy ways Rails has attempted tags, we need this crazy method.
|
58
57
|
def extract_active_support_tagged_logging_tags
|
59
|
-
|
58
|
+
@current_tags ||
|
59
|
+
Thread.current[:activesupport_tagged_logging_tags] ||
|
60
60
|
Thread.current[tagged_logging_object_key_name] ||
|
61
61
|
EMPTY_ARRAY
|
62
62
|
end
|
data/lib/logtail/version.rb
CHANGED
@@ -30,6 +30,7 @@ describe Logtail::LogEntry do
|
|
30
30
|
expect(hash[:context][:runtime][:file]).to end_with('/spec/logtail/log_entry_spec.rb')
|
31
31
|
expect(hash[:context][:runtime][:line]).to be(25)
|
32
32
|
expect(hash[:context][:runtime][:frame_label]).to_not be_nil
|
33
|
+
expect(hash[:context][:runtime][:frame_label].encoding.to_s).to eq('UTF-8')
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logtail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logtail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|