imprint 1.4.3.pre2 → 1.4.3.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -1
- data/lib/imprint/rails_logger.rb +4 -4
- data/lib/imprint/tracer.rb +7 -7
- data/lib/imprint/version.rb +1 -1
- metadata +21 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8158732d6953a6ab13497d6fc5306fa8eb6d65ef
|
4
|
+
data.tar.gz: 2cd801d66940df96573043193c9f231608f6af96
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6fe8018a746c2b8cb52896739521a8fbf549366a6c9ff019a19e66ade505734daafe012fa9c3d4dfbd29f346127427c9fea60b49ca08046aee943d4c9383f589
|
7
|
+
data.tar.gz: f2e296db54992e6155fa2636df3ad6e3fc96cc81a1dad4b44a04fdbfed286c610d5fe46c481e7f8b58a63d94e1d4d1f211794993126c2ca55c6955066b08bc18
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
imprint
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
2.1.6
|
data/lib/imprint/rails_logger.rb
CHANGED
@@ -11,7 +11,7 @@ if defined?(ActiveSupport::BufferedLogger)
|
|
11
11
|
# Ensures that the original message is not mutated.
|
12
12
|
message = "#{message}\n" unless message[-1] == "\n"
|
13
13
|
if defined?(Imprint::Tracer)
|
14
|
-
Imprint::Tracer.insert_trace_id_in_message(message)
|
14
|
+
Imprint::Tracer.insert_trace_id_in_message(message, severity)
|
15
15
|
end
|
16
16
|
buffer << message
|
17
17
|
auto_flush
|
@@ -24,7 +24,7 @@ if defined?(ActiveSupport::BufferedLogger)
|
|
24
24
|
# Ensures that the original message is not mutated.
|
25
25
|
message = "#{message}\n" unless message[-1] == "\n"
|
26
26
|
if defined?(Imprint::Tracer)
|
27
|
-
Imprint::Tracer.insert_trace_id_in_message(message)
|
27
|
+
Imprint::Tracer.insert_trace_id_in_message(message, severity)
|
28
28
|
end
|
29
29
|
@log.add(severity, message, progname, &block)
|
30
30
|
end
|
@@ -43,7 +43,7 @@ if defined?(ActiveSupport::Logger::SimpleFormatter)
|
|
43
43
|
# Ensures that the original message is not mutated.
|
44
44
|
message = "#{message}\n" unless message[-1] == "\n"
|
45
45
|
if defined?(Imprint::Tracer)
|
46
|
-
Imprint::Tracer.insert_trace_id_in_message(message)
|
46
|
+
Imprint::Tracer.insert_trace_id_in_message(message, severity)
|
47
47
|
end
|
48
48
|
message
|
49
49
|
end
|
@@ -55,7 +55,7 @@ if defined?(ActiveSupport::Logger::SimpleFormatter)
|
|
55
55
|
message = msg2str(msg)
|
56
56
|
message = "#{message}\n" unless message[-1] == "\n"
|
57
57
|
if defined?(Imprint::Tracer)
|
58
|
-
Imprint::Tracer.insert_trace_id_in_message(message)
|
58
|
+
Imprint::Tracer.insert_trace_id_in_message(message, severity)
|
59
59
|
end
|
60
60
|
Format % [severity[0..0], format_datetime(time), $$, severity, progname, message]
|
61
61
|
end
|
data/lib/imprint/tracer.rb
CHANGED
@@ -5,11 +5,10 @@ module Imprint
|
|
5
5
|
RAILS_REQUEST_ID = "action_dispatch.request_id"
|
6
6
|
TRACE_ID_DEFAULT = "-1"
|
7
7
|
TRACER_TIMESTAMP = "TIMESTAMP"
|
8
|
-
|
9
|
-
TRACE_CHARS = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
|
8
|
+
TRACE_CHARS = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
|
10
9
|
|
11
10
|
def self.set_trace_id(id, rack_env = {})
|
12
|
-
|
11
|
+
get_trace_timestamp
|
13
12
|
Thread.current[TRACER_KEY] = id
|
14
13
|
# setting to the rack_env, gives error tracking support in some systems
|
15
14
|
rack_env[TRACER_KEY] = id
|
@@ -23,16 +22,16 @@ module Imprint
|
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
26
|
-
def
|
27
|
-
Thread.current[TRACER_TIMESTAMP] ||= Time.now.strftime("%Y-%m-%dT%H:%M:%S.%6N")
|
25
|
+
def self.get_trace_timestamp
|
26
|
+
Thread.current[TRACER_TIMESTAMP] ||= Time.now.strftime("%Y-%m-%dT%H:%M:%S.%6N") + " ##{$$}"
|
28
27
|
end
|
29
28
|
|
30
|
-
def self.insert_trace_id_in_message(message)
|
29
|
+
def self.insert_trace_id_in_message(message, severity = nil)
|
31
30
|
if message && message.is_a?(String) && message.length > 1 && !message.include?('trace_id=')
|
32
31
|
trace_id = get_trace_id
|
33
32
|
|
34
33
|
if trace_id && trace_id != TRACE_ID_DEFAULT
|
35
|
-
|
34
|
+
message.insert 0, "[#{get_trace_timestamp}] #{severity} -- : "
|
36
35
|
message.gsub!("\n"," trace_id=#{trace_id}\n")
|
37
36
|
end
|
38
37
|
end
|
@@ -43,3 +42,4 @@ module Imprint
|
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
45
|
+
|
data/lib/imprint/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: imprint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.3.
|
5
|
-
prerelease: 6
|
4
|
+
version: 1.4.3.pre3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dan Mayer
|
@@ -14,97 +13,85 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: shoulda
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rack
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: simplecov
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: timecop
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
description: A gem to help improve logging. Focused on request tracing and cross app
|
@@ -115,8 +102,9 @@ executables: []
|
|
115
102
|
extensions: []
|
116
103
|
extra_rdoc_files: []
|
117
104
|
files:
|
118
|
-
- .gitignore
|
119
|
-
- .ruby-
|
105
|
+
- ".gitignore"
|
106
|
+
- ".ruby-gemset"
|
107
|
+
- ".ruby-version"
|
120
108
|
- Gemfile
|
121
109
|
- LICENSE.txt
|
122
110
|
- README.md
|
@@ -136,30 +124,26 @@ files:
|
|
136
124
|
homepage: ''
|
137
125
|
licenses:
|
138
126
|
- MIT
|
127
|
+
metadata: {}
|
139
128
|
post_install_message:
|
140
129
|
rdoc_options: []
|
141
130
|
require_paths:
|
142
131
|
- lib
|
143
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
133
|
requirements:
|
146
|
-
- -
|
134
|
+
- - ">="
|
147
135
|
- !ruby/object:Gem::Version
|
148
136
|
version: '0'
|
149
|
-
segments:
|
150
|
-
- 0
|
151
|
-
hash: 2015645248561803847
|
152
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
138
|
requirements:
|
155
|
-
- -
|
139
|
+
- - ">"
|
156
140
|
- !ruby/object:Gem::Version
|
157
141
|
version: 1.3.1
|
158
142
|
requirements: []
|
159
143
|
rubyforge_project:
|
160
|
-
rubygems_version:
|
144
|
+
rubygems_version: 2.4.3
|
161
145
|
signing_key:
|
162
|
-
specification_version:
|
146
|
+
specification_version: 4
|
163
147
|
summary: A gem to help improve logging. Focused on request tracing and cross app tracing.
|
164
148
|
test_files:
|
165
149
|
- test/test_helper.rb
|