hedgelog 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +0 -1
- data/lib/hedgelog/version.rb +1 -1
- data/lib/hedgelog.rb +18 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTZjNDlkZDk3YTc3YzQwNGIzODBiOTI1ZmVmMDAyMTkzZjBjNzYxMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzQ2ZmZlZWU4Yjc4YWJkODQ3NmRlNmIwYTQ3YzdjMDg4MjhjYmU5Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YjNiMTc0MTUxZWIyNWYyZGNiZjU4NzM4NTgyYmVjOTdkYzNmMDkyNGFjZTA3
|
10
|
+
OWI5MjY5ZmE4MmFkNjgwZjE3YmE0NTA2ZmZhNzFkMGU1ZDM1NzE5NThhYjAz
|
11
|
+
YzMwMDAwYWRmNTI0YjQyNWQ5OTA5ODY5M2RlMDVmYzMyNDVhMTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmRjZjcxODc3MWNmNjUyYmRiZTAyOWY5NGU5NDBiMTQzNjAzYjU1NzA2MTA1
|
14
|
+
NzU0Mzc0MmU5ZTZmMzYxODFjMDIyNWY0MWUzZGI4ZDFiZDBlNzA5NzQ4Njhj
|
15
|
+
MjRkZjQ5Yzk5NTcwOTVhNjgyYWU0YTY5ZWViYjA4YTlhZWQyNWU=
|
data/.travis.yml
CHANGED
data/lib/hedgelog/version.rb
CHANGED
data/lib/hedgelog.rb
CHANGED
@@ -21,6 +21,9 @@ class Hedgelog
|
|
21
21
|
TIMESTAMP_FORMAT = '%Y-%m-%dT%H:%M:%S.%6N%z'.freeze
|
22
22
|
BACKTRACE_RE = /([^:]+):([0-9]+)(?::in `(.*)')?/
|
23
23
|
|
24
|
+
attr_reader :level
|
25
|
+
attr_writer :app
|
26
|
+
|
24
27
|
def initialize(logdev = STDOUT, shift_age = nil, shift_size = nil)
|
25
28
|
@level = LEVELS[:debug]
|
26
29
|
@channel = nil
|
@@ -37,16 +40,12 @@ class Hedgelog
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
|
-
attr_reader :level
|
41
|
-
|
42
43
|
def level=(level)
|
43
44
|
int_level = level_to_int(level)
|
44
45
|
raise ::ArgumentError, "#{self.class}#level= , #{level} is not a valid level." if int_level.nil?
|
45
46
|
@level = int_level
|
46
47
|
end
|
47
48
|
|
48
|
-
attr_writer :app
|
49
|
-
|
50
49
|
def add(severity = LEVELS[:unknown], message = nil, progname = nil, context = {}, &block)
|
51
50
|
return true if (@logdev.nil? && @channel.nil?) || severity < @level
|
52
51
|
|
@@ -106,15 +105,28 @@ class Hedgelog
|
|
106
105
|
end
|
107
106
|
end
|
108
107
|
|
108
|
+
def silence(temporary_level = LEVELS[:error])
|
109
|
+
old_level = level
|
110
|
+
self.level = temporary_level
|
111
|
+
|
112
|
+
yield self
|
113
|
+
ensure
|
114
|
+
self.level = old_level
|
115
|
+
end
|
116
|
+
|
117
|
+
def formatter
|
118
|
+
::Logger::Formatter.new
|
119
|
+
end
|
120
|
+
|
109
121
|
private
|
110
122
|
|
111
123
|
def level_to_int(level)
|
112
|
-
return level if level.is_a?(
|
124
|
+
return level if level.is_a?(Integer)
|
113
125
|
LEVELS[level]
|
114
126
|
end
|
115
127
|
|
116
128
|
def level_from_int(level)
|
117
|
-
return LEVELS[level] if level.is_a?(
|
129
|
+
return LEVELS[level] if level.is_a?(Integer)
|
118
130
|
level.to_sym
|
119
131
|
end
|
120
132
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hedgelog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Utter
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yajl-ruby
|