logtail-rails 0.1.8 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +53 -97
- data/README.md +3 -3
- data/example-project/Gemfile +1 -1
- data/gemfiles/{rails-4.1.gemfile → rails-7.0.gemfile} +1 -1
- data/lib/logtail-rails/overrides/active_support_tagged_logging.rb +6 -5
- data/lib/logtail-rails/overrides.rb +0 -1
- data/lib/logtail-rails/railtie.rb +0 -4
- data/lib/logtail-rails/version.rb +1 -1
- data/logtail-rails.gemspec +5 -5
- metadata +11 -18
- data/gemfiles/rails-3.0.gemfile +0 -8
- data/gemfiles/rails-3.1.gemfile +0 -8
- data/gemfiles/rails-3.2.gemfile +0 -8
- data/gemfiles/rails-4.0.gemfile +0 -12
- data/gemfiles/rails-4.2.gemfile +0 -12
- data/gemfiles/rails-edge.gemfile +0 -10
- data/lib/logtail-rails/overrides/active_support_3_tagged_logging.rb +0 -111
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed20f6d4677ee4cce10f91ce1acde469e3f201c12092aaccec4d172137089119
|
4
|
+
data.tar.gz: 3c8e38d62f4a9b58c37ec1aae0f1cdddbbddec16cd8caf3d790cba641fd8effa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0394b6d9ec9e4282082ed6abde5ae81a6ec0768faa738c5f6c753535bfb7ddf4e3913839393ef59ddd968d99816a53abf7ad7f6f173ced965c4abb28c20f695
|
7
|
+
data.tar.gz: 1a77af8d51a25997f1af62d066868fd73bda872b2932c499d688c04829d2a5abad15b3398435db95164e81b8948040725186bb5f36135756cdcf1cc544de9050
|
data/.github/workflows/main.yml
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
name: build
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
schedule:
|
7
|
+
- cron: '20 5 * * 1'
|
8
|
+
workflow_dispatch:
|
4
9
|
|
5
10
|
jobs:
|
6
11
|
test:
|
@@ -11,117 +16,69 @@ jobs:
|
|
11
16
|
|
12
17
|
matrix:
|
13
18
|
ruby-version:
|
14
|
-
- 3.
|
19
|
+
- 3.2.2
|
20
|
+
- 3.1.4
|
21
|
+
- 3.0.6
|
15
22
|
- 2.7.2
|
16
23
|
- 2.6.6
|
17
24
|
- 2.5.8
|
18
|
-
-
|
19
|
-
- 2.3.8
|
20
|
-
- 2.2.10
|
25
|
+
- jruby-9.4.3.0
|
21
26
|
- jruby-9.2.14.0
|
22
|
-
- truffleruby-
|
27
|
+
- truffleruby-23.0.0
|
28
|
+
- truffleruby-22.1.0
|
23
29
|
gemfile:
|
24
|
-
- rails-
|
30
|
+
- rails-7.0
|
25
31
|
- rails-6.1
|
26
32
|
- rails-6.0
|
27
33
|
- rails-5.2
|
28
34
|
- rails-5.1
|
29
35
|
- rails-5.0
|
30
36
|
exclude:
|
31
|
-
- gemfile: rails-
|
37
|
+
- gemfile: rails-7.0
|
32
38
|
ruby-version: 2.6.6
|
33
|
-
- gemfile: rails-
|
39
|
+
- gemfile: rails-7.0
|
34
40
|
ruby-version: 2.5.8
|
35
|
-
- gemfile: rails-
|
36
|
-
ruby-version: 2.4.10
|
37
|
-
- gemfile: rails-edge
|
38
|
-
ruby-version: 2.3.8
|
39
|
-
- gemfile: rails-edge
|
40
|
-
ruby-version: 2.2.10
|
41
|
-
- gemfile: rails-edge
|
41
|
+
- gemfile: rails-7.0
|
42
42
|
ruby-version: jruby-9.2.14.0
|
43
|
-
- gemfile: rails-edge
|
44
|
-
ruby-version: truffleruby-21.0.0
|
45
|
-
|
46
|
-
- ruby-version: 3.0.0
|
47
|
-
gemfile: rails-5.2
|
48
|
-
- ruby-version: 3.0.0
|
49
|
-
gemfile: rails-5.1
|
50
|
-
- ruby-version: 3.0.0
|
51
|
-
gemfile: rails-5.0
|
52
|
-
|
53
|
-
- gemfile: rails-6.1
|
54
|
-
ruby-version: 2.4.10
|
55
|
-
- gemfile: rails-6.1
|
56
|
-
ruby-version: 2.3.8
|
57
|
-
- gemfile: rails-6.1
|
58
|
-
ruby-version: 2.2.10
|
59
|
-
- gemfile: rails-6.1
|
60
|
-
ruby-version: 2.2.10
|
61
|
-
|
62
|
-
- gemfile: rails-6.0
|
63
|
-
ruby-version: 2.4.10
|
64
|
-
- gemfile: rails-6.0
|
65
|
-
ruby-version: 2.3.8
|
66
|
-
- gemfile: rails-6.0
|
67
|
-
ruby-version: 2.2.10
|
68
43
|
|
69
44
|
- gemfile: rails-5.2
|
70
|
-
ruby-version: 2.2
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
-
|
102
|
-
|
103
|
-
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
- rails-4.1
|
108
|
-
- rails-4.0
|
109
|
-
- rails-3.2
|
110
|
-
|
111
|
-
exclude:
|
112
|
-
- gemfile: rails-4.1
|
113
|
-
ruby-version: 2.6.6
|
114
|
-
- gemfile: rails-4.1
|
115
|
-
ruby-version: 2.5.8
|
116
|
-
- gemfile: rails-4.1
|
117
|
-
ruby-version: 2.4.10
|
118
|
-
|
119
|
-
- gemfile: rails-4.0
|
120
|
-
ruby-version: 2.6.6
|
121
|
-
- gemfile: rails-4.0
|
122
|
-
ruby-version: 2.5.8
|
123
|
-
- gemfile: rails-4.0
|
124
|
-
ruby-version: 2.4.10
|
45
|
+
ruby-version: 3.2.2
|
46
|
+
- gemfile: rails-5.2
|
47
|
+
ruby-version: 3.1.4
|
48
|
+
- gemfile: rails-5.2
|
49
|
+
ruby-version: 3.0.6
|
50
|
+
- gemfile: rails-5.2
|
51
|
+
ruby-version: jruby-9.4.3.0
|
52
|
+
- gemfile: rails-5.2
|
53
|
+
ruby-version: truffleruby-22.1.0
|
54
|
+
- gemfile: rails-5.2
|
55
|
+
ruby-version: truffleruby-23.0.0
|
56
|
+
|
57
|
+
- gemfile: rails-5.1
|
58
|
+
ruby-version: 3.2.2
|
59
|
+
- gemfile: rails-5.1
|
60
|
+
ruby-version: 3.1.4
|
61
|
+
- gemfile: rails-5.1
|
62
|
+
ruby-version: 3.0.6
|
63
|
+
- gemfile: rails-5.1
|
64
|
+
ruby-version: jruby-9.4.3.0
|
65
|
+
- gemfile: rails-5.1
|
66
|
+
ruby-version: truffleruby-23.0.0
|
67
|
+
- gemfile: rails-5.1
|
68
|
+
ruby-version: truffleruby-22.1.0
|
69
|
+
|
70
|
+
- gemfile: rails-5.0
|
71
|
+
ruby-version: 3.2.2
|
72
|
+
- gemfile: rails-5.0
|
73
|
+
ruby-version: 3.1.4
|
74
|
+
- gemfile: rails-5.0
|
75
|
+
ruby-version: 3.0.6
|
76
|
+
- gemfile: rails-5.0
|
77
|
+
ruby-version: jruby-9.4.3.0
|
78
|
+
- gemfile: rails-5.0
|
79
|
+
ruby-version: truffleruby-23.0.0
|
80
|
+
- gemfile: rails-5.0
|
81
|
+
ruby-version: truffleruby-22.1.0
|
125
82
|
|
126
83
|
env:
|
127
84
|
BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
|
@@ -136,7 +93,6 @@ jobs:
|
|
136
93
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
137
94
|
uses: ruby/setup-ruby@v1
|
138
95
|
with:
|
139
|
-
bundler: 1.17
|
140
96
|
ruby-version: ${{ matrix.ruby-version }}
|
141
97
|
bundler-cache: true
|
142
98
|
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[![Logtail ruby dashboard](https://user-images.githubusercontent.com/19272921/154085622-59997d5a-3f91-4bc9-a815-3b8ead16d28d.jpeg)](https://betterstack.com/logtail)
|
4
4
|
|
5
5
|
[![ISC License](https://img.shields.io/badge/license-ISC-ff69b4.svg)](LICENSE.md)
|
6
|
-
[![Gem Version](https://badge.fury.io/rb/logtail-
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/logtail-rails.svg)](https://badge.fury.io/rb/logtail-rails)
|
7
7
|
[![Build Status](https://github.com/logtail/logtail-ruby-rails/workflows/build/badge.svg)](https://github.com/logtail/logtail-ruby-rails/actions?query=workflow%3Abuild)
|
8
8
|
|
9
9
|
Collect logs directly from your Ruby on Rails projects. To start logging Ruby projects explore the [Logtail Ruby library](https://github.com/logtail/logtail-ruby).
|
@@ -17,8 +17,8 @@ Collect logs directly from your Ruby on Rails projects. To start logging Ruby pr
|
|
17
17
|
- Performant, light weight, with a thoughtful design.
|
18
18
|
|
19
19
|
### Supported language versions
|
20
|
-
- Ruby 2.
|
21
|
-
- Rails
|
20
|
+
- Ruby 2.5 or newer
|
21
|
+
- Rails 5.0 or newer
|
22
22
|
|
23
23
|
# Installation
|
24
24
|
Install the Logtail Ruby on Rails client library, run the following command:
|
data/example-project/Gemfile
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# This is an override instead of an integration because without this Logtail would not
|
2
2
|
# work properly if ActiveSupport::TaggedLogging is used.
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if defined?(ActiveSupport::TaggedLogging)
|
3
|
+
|
4
|
+
begin
|
5
|
+
require "active_support/tagged_logging"
|
6
|
+
|
8
7
|
module Logtail
|
9
8
|
module Overrides
|
10
9
|
# @private
|
@@ -63,4 +62,6 @@ if defined?(ActiveSupport::TaggedLogging)
|
|
63
62
|
end
|
64
63
|
end
|
65
64
|
end
|
65
|
+
|
66
|
+
rescue Exception
|
66
67
|
end
|
@@ -6,10 +6,6 @@ module Logtail
|
|
6
6
|
# Installs Logtail into your Rails app automatically.
|
7
7
|
class Railtie < ::Rails::Railtie
|
8
8
|
railtie_name 'logtail-rails'
|
9
|
-
rake_tasks do
|
10
|
-
path = File.expand_path(__dir__)
|
11
|
-
load "#{path}/tasks/logtail.rake"
|
12
|
-
end
|
13
9
|
|
14
10
|
config.logtail = Config.instance
|
15
11
|
|
data/logtail-rails.gemspec
CHANGED
@@ -5,14 +5,14 @@ require "logtail-rails/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "logtail-rails"
|
7
7
|
spec.version = Logtail::Integrations::Rails::VERSION
|
8
|
-
spec.authors = ["
|
8
|
+
spec.authors = ["Better Stack"]
|
9
9
|
spec.email = ["hello@betterstack.com"]
|
10
10
|
|
11
11
|
spec.summary = %q{Better Stack Rails integration}
|
12
12
|
spec.homepage = "https://github.com/logtail/logtail-ruby-rails"
|
13
13
|
spec.license = "ISC"
|
14
14
|
|
15
|
-
spec.required_ruby_version = '>= 2.
|
15
|
+
spec.required_ruby_version = '>= 2.5.0'
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/logtail/logtail-ruby-rails"
|
@@ -30,9 +30,9 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_runtime_dependency "logtail", "~> 0.1"
|
31
31
|
spec.add_runtime_dependency "logtail-rack", "~> 0.1"
|
32
32
|
|
33
|
-
spec.add_runtime_dependency 'activerecord', '>=
|
34
|
-
spec.add_runtime_dependency 'railties', '>=
|
35
|
-
spec.add_runtime_dependency 'actionpack', '>=
|
33
|
+
spec.add_runtime_dependency 'activerecord', '>= 5.0.0'
|
34
|
+
spec.add_runtime_dependency 'railties', '>= 5.0.0'
|
35
|
+
spec.add_runtime_dependency 'actionpack', '>= 5.0.0'
|
36
36
|
|
37
37
|
spec.add_development_dependency "bundler", ">= 0.0"
|
38
38
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logtail-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Better Stack
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
@@ -44,42 +44,42 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 5.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 5.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: railties
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 5.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 5.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: actionpack
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 5.0.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 5.0.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -300,18 +300,12 @@ files:
|
|
300
300
|
- example-project/tmp/storage/.keep
|
301
301
|
- example-project/vendor/.keep
|
302
302
|
- example-project/vendor/javascript/.keep
|
303
|
-
- gemfiles/rails-3.0.gemfile
|
304
|
-
- gemfiles/rails-3.1.gemfile
|
305
|
-
- gemfiles/rails-3.2.gemfile
|
306
|
-
- gemfiles/rails-4.0.gemfile
|
307
|
-
- gemfiles/rails-4.1.gemfile
|
308
|
-
- gemfiles/rails-4.2.gemfile
|
309
303
|
- gemfiles/rails-5.0.gemfile
|
310
304
|
- gemfiles/rails-5.1.gemfile
|
311
305
|
- gemfiles/rails-5.2.gemfile
|
312
306
|
- gemfiles/rails-6.0.gemfile
|
313
307
|
- gemfiles/rails-6.1.gemfile
|
314
|
-
- gemfiles/rails-
|
308
|
+
- gemfiles/rails-7.0.gemfile
|
315
309
|
- lib/logtail-rails.rb
|
316
310
|
- lib/logtail-rails/action_controller.rb
|
317
311
|
- lib/logtail-rails/action_controller/log_subscriber.rb
|
@@ -333,7 +327,6 @@ files:
|
|
333
327
|
- lib/logtail-rails/log_entry.rb
|
334
328
|
- lib/logtail-rails/logger.rb
|
335
329
|
- lib/logtail-rails/overrides.rb
|
336
|
-
- lib/logtail-rails/overrides/active_support_3_tagged_logging.rb
|
337
330
|
- lib/logtail-rails/overrides/active_support_buffered_logger.rb
|
338
331
|
- lib/logtail-rails/overrides/active_support_tagged_logging.rb
|
339
332
|
- lib/logtail-rails/overrides/lograge.rb
|
@@ -358,14 +351,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
358
351
|
requirements:
|
359
352
|
- - ">="
|
360
353
|
- !ruby/object:Gem::Version
|
361
|
-
version: 2.
|
354
|
+
version: 2.5.0
|
362
355
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
363
356
|
requirements:
|
364
357
|
- - ">="
|
365
358
|
- !ruby/object:Gem::Version
|
366
359
|
version: '0'
|
367
360
|
requirements: []
|
368
|
-
rubygems_version: 3.
|
361
|
+
rubygems_version: 3.4.10
|
369
362
|
signing_key:
|
370
363
|
specification_version: 4
|
371
364
|
summary: Better Stack Rails integration
|
data/gemfiles/rails-3.0.gemfile
DELETED
data/gemfiles/rails-3.1.gemfile
DELETED
data/gemfiles/rails-3.2.gemfile
DELETED
data/gemfiles/rails-4.0.gemfile
DELETED
data/gemfiles/rails-4.2.gemfile
DELETED
data/gemfiles/rails-edge.gemfile
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rack', git: 'https://github.com/rack/rack', branch: 'master'
|
4
|
-
gem 'arel', git: 'https://github.com/rails/arel', branch: 'master'
|
5
|
-
gem 'rails', git: 'https://github.com/rails/rails', branch: 'main'
|
6
|
-
|
7
|
-
gem 'logtail'
|
8
|
-
gem 'logtail-rack'
|
9
|
-
|
10
|
-
gemspec :path => '../'
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# Please note, this patch is merely an upgrade, backporting improved tagged logging code
|
2
|
-
# from newer versions of Rails:
|
3
|
-
# https://github.com/rails/rails/blob/5-1-stable/activesupport/lib/active_support/tagged_logging.rb
|
4
|
-
# The behavior of tagged logging will not change in any way.
|
5
|
-
#
|
6
|
-
# This patch is specifically for Rails 3. The legacy approach to wrapping the logger in
|
7
|
-
# ActiveSupport::TaggedLogging is rather poor, hence the reason it was changed entirely
|
8
|
-
# for Rails 4 and 5. The problem is that ActiveSupport::TaggedLogging is a wrapping
|
9
|
-
# class that entirely redefines the public API for the logger. As a result, any deviations
|
10
|
-
# from this API in the logger are not exposed (such as accepting event data as a second argument).
|
11
|
-
# This is assuming, so we're fixing it here.
|
12
|
-
|
13
|
-
begin
|
14
|
-
require "active_support/tagged_logging"
|
15
|
-
|
16
|
-
# Instead of patching the class we're pulling the code from Rails master. This brings in
|
17
|
-
# a number of improvements while also addressing the issue above.
|
18
|
-
if ActiveSupport::TaggedLogging.instance_of?(Class)
|
19
|
-
ActiveSupport.send(:remove_const, :TaggedLogging)
|
20
|
-
|
21
|
-
require "active_support/core_ext/module/delegation"
|
22
|
-
require "active_support/core_ext/object/blank"
|
23
|
-
require "logger"
|
24
|
-
|
25
|
-
module ActiveSupport
|
26
|
-
# Wraps any standard Logger object to provide tagging capabilities.
|
27
|
-
#
|
28
|
-
# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
|
29
|
-
# logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff"
|
30
|
-
# logger.tagged('BCX', "Jason") { logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff"
|
31
|
-
# logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff"
|
32
|
-
#
|
33
|
-
# This is used by the default Rails.logger as configured by Railties to make
|
34
|
-
# it easy to stamp log lines with subdomains, request ids, and anything else
|
35
|
-
# to aid debugging of multi-user production applications.
|
36
|
-
module TaggedLogging
|
37
|
-
module Formatter # :nodoc:
|
38
|
-
# This method is invoked when a log event occurs.
|
39
|
-
def call(severity, timestamp, progname, msg)
|
40
|
-
super(severity, timestamp, progname, "#{tags_text}#{msg}")
|
41
|
-
end
|
42
|
-
|
43
|
-
def tagged(*tags)
|
44
|
-
new_tags = push_tags(*tags)
|
45
|
-
yield self
|
46
|
-
ensure
|
47
|
-
pop_tags(new_tags.size)
|
48
|
-
end
|
49
|
-
|
50
|
-
def push_tags(*tags)
|
51
|
-
tags.flatten.reject(&:blank?).tap do |new_tags|
|
52
|
-
current_tags.concat new_tags
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def pop_tags(size = 1)
|
57
|
-
current_tags.pop size
|
58
|
-
end
|
59
|
-
|
60
|
-
def clear_tags!
|
61
|
-
current_tags.clear
|
62
|
-
end
|
63
|
-
|
64
|
-
def current_tags
|
65
|
-
# We use our object ID here to avoid conflicting with other instances
|
66
|
-
thread_key = @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}".freeze
|
67
|
-
Thread.current[thread_key] ||= []
|
68
|
-
end
|
69
|
-
|
70
|
-
def tags_text
|
71
|
-
tags = current_tags
|
72
|
-
if tags.any?
|
73
|
-
tags.collect { |tag| "[#{tag}] " }.join
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
# Simple formatter which only displays the message.
|
79
|
-
class SimpleFormatter < ::Logger::Formatter
|
80
|
-
# This method is invoked when a log event occurs
|
81
|
-
def call(severity, timestamp, progname, msg)
|
82
|
-
"#{String === msg ? msg : msg.inspect}\n"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def self.new(logger)
|
87
|
-
if logger.respond_to?(:formatter=) && logger.respond_to?(:formatter)
|
88
|
-
# Ensure we set a default formatter so we aren't extending nil!
|
89
|
-
logger.formatter ||= SimpleFormatter.new
|
90
|
-
logger.formatter.extend Formatter
|
91
|
-
end
|
92
|
-
|
93
|
-
logger.extend(self)
|
94
|
-
end
|
95
|
-
|
96
|
-
delegate :push_tags, :pop_tags, :clear_tags!, to: :formatter
|
97
|
-
|
98
|
-
def tagged(*tags)
|
99
|
-
formatter.tagged(*tags) { yield self }
|
100
|
-
end
|
101
|
-
|
102
|
-
def flush
|
103
|
-
clear_tags!
|
104
|
-
super if defined?(super)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
rescue Exception
|
111
|
-
end
|