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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ba9fd4e5a7de0392375297a8ac475049499afebb82b904ce43615f1b1c5e000
4
- data.tar.gz: 0073e828790ded81976eefb1d42d48e0c9eff3123dc47c4c861960bf9a611ff2
3
+ metadata.gz: 9bb7693b6aa0c18cdfd743e711bbfb2a07d21e580e3698d9c361a4501aed76a8
4
+ data.tar.gz: 48b28d5a283ce2fb97221dc9d940f4443ece4f576a6bfa8ddceb0fc8321233bb
5
5
  SHA512:
6
- metadata.gz: 9c79321cad971e6fa844c08525b6b308594572e728f465561d4f9f594ddb4009047491014f4bc7267292e5d3f3c3d0249e5c0a27d5fb6f7107fd1a79cc10c36e
7
- data.tar.gz: 37614b8402998ebfbf9d40741fcbe8085fa4beaf86cd0dfe2b6a2028e08b25a238e26dbd4efb6b5e2406116db2599e135f4f802135d2fc6bbf14e2d3809fcb96
6
+ metadata.gz: 646bc1896d44fa7704355a9426921a35eda9d34e0f80f8aaa7e35d91adc78fa51ab39fbde249b8835f6045720d6260b08c9687964072c9562dad4053720a9804
7
+ data.tar.gz: a13480d4db23662178079edd858cf0ceb0fe33f90bdfc5acb178aadc2187e5ee5634b58ac7c5cc6a7c14fcbd367b32f58fa187d9687e22a0741a02ff9121791a
data/CHANGELOG.md CHANGED
@@ -18,3 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
18
18
  ## [0.1.3] - 2021-06-11
19
19
 
20
20
  - Fixed detection of the frame that calls the logger.
21
+
22
+ ## [0.1.7] - 2021-08-16
23
+
24
+ - Fixed runtime context's frame label encoding.
@@ -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.to_s
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 || '/'))
@@ -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
- Thread.current[:activesupport_tagged_logging_tags] ||
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
@@ -1,3 +1,3 @@
1
1
  module Logtail
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -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.3
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-06-11 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack