tracee 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tracee/logger.rb +25 -2
- data/lib/tracee/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 619ff9514d9aaf865e6cdc037ac907cb65370eaa
|
4
|
+
data.tar.gz: 6c299eedba583c35c9bb6b61a9ee17692d998351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14e6cda31a2ce041ef3ee1ec6dcfdec183ae88618d0eabc13a0cf7670f2ac0d69e4c8c2e0d8bd4bd3703b844ff3c4fa0419bf82641ac1dd0eb78993bc916a6e8
|
7
|
+
data.tar.gz: 37ad87036bb943ab14186cdc78ee1b0629e28b0fb7f3fc16adda88b3c37e780040721a48a372fdcea299e06893a13ebe2d9d0c34113f564138e4a7cbd9b69f78
|
data/lib/tracee/logger.rb
CHANGED
@@ -77,7 +77,15 @@ module Tracee
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def level=(level)
|
80
|
-
|
80
|
+
Thread.current["tracee_#{__id__}_level"] = @level = norm_level(level)
|
81
|
+
end
|
82
|
+
|
83
|
+
def local_level=(level)
|
84
|
+
Thread.current["tracee_#{__id__}_level"] = norm_level(level)
|
85
|
+
end
|
86
|
+
|
87
|
+
def local_level
|
88
|
+
Thread.current["tracee_#{__id__}_level"] ||= @level
|
81
89
|
end
|
82
90
|
|
83
91
|
alias log_level= level=
|
@@ -108,7 +116,7 @@ module Tracee
|
|
108
116
|
|
109
117
|
class_eval <<-EOS, __FILE__, __LINE__+1
|
110
118
|
def #{level_name}(*args, &block)
|
111
|
-
return if
|
119
|
+
return if local_level > #{level_int}
|
112
120
|
|
113
121
|
unless args[1].nil? or args[1].is_a?(Hash)
|
114
122
|
raise TypeError, "\#{self.class.name}#\#{__callee__}'s second argument if given, is expected to be Hash. \#{args[1].class.name} is given."
|
@@ -152,8 +160,23 @@ module Tracee
|
|
152
160
|
alias < warn
|
153
161
|
|
154
162
|
|
163
|
+
def silence(temporary_level=:error)
|
164
|
+
begin
|
165
|
+
old_local_level = local_level
|
166
|
+
self.local_level = temporary_level
|
167
|
+
|
168
|
+
yield self
|
169
|
+
ensure
|
170
|
+
self.local_level = old_local_level
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
155
174
|
private
|
156
175
|
|
176
|
+
def norm_level(level)
|
177
|
+
level.is_a?(Integer) ? level : LEVELS.index(level.to_s.upcase)
|
178
|
+
end
|
179
|
+
|
157
180
|
def read_log_level_from_env
|
158
181
|
if ENV['LOG_LEVEL'] and LEVELS.include? ENV['LOG_LEVEL']
|
159
182
|
self.log_level = ENV['LOG_LEVEL']
|
data/lib/tracee/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Baev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|