logasm 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/logasm.rb +14 -14
- data/logasm.gemspec +1 -1
- data/spec/logasm_spec.rb +14 -0
- metadata +3 -4
- data/Gemfile.lock +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d741421e6be6392f9314977ca8f1b1f92ed860e8
|
4
|
+
data.tar.gz: 6353fc8224e2d571486c928e9a4c2844301924da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b4f9fa351e2a5072dfed0b4f3604e3e623499e55edc8944f06e0bb866cd2a70a4b491d65f95dcae5e090f50475c6e2d679201c23192b1b2545e494b5948a13
|
7
|
+
data.tar.gz: 05015cf1d0ec0e656b12d1a5d498d672bac113447da59c4c0cc332a632d32c7643a79c325202cd8d6402504722247e5c9bd74d2d9c74c0cf064ff3e0df1c1f48
|
data/.gitignore
CHANGED
data/lib/logasm.rb
CHANGED
@@ -25,24 +25,24 @@ class Logasm
|
|
25
25
|
@preprocessors = preprocessors
|
26
26
|
end
|
27
27
|
|
28
|
-
def debug(*args)
|
29
|
-
log :debug, *args
|
28
|
+
def debug(*args, &block)
|
29
|
+
log :debug, *args, &block
|
30
30
|
end
|
31
31
|
|
32
|
-
def info(*args)
|
33
|
-
log :info, *args
|
32
|
+
def info(*args, &block)
|
33
|
+
log :info, *args, &block
|
34
34
|
end
|
35
35
|
|
36
|
-
def warn(*args)
|
37
|
-
log :warn, *args
|
36
|
+
def warn(*args, &block)
|
37
|
+
log :warn, *args, &block
|
38
38
|
end
|
39
39
|
|
40
|
-
def error(*args)
|
41
|
-
log :error, *args
|
40
|
+
def error(*args, &block)
|
41
|
+
log :error, *args, &block
|
42
42
|
end
|
43
43
|
|
44
|
-
def fatal(*args)
|
45
|
-
log :fatal, *args
|
44
|
+
def fatal(*args, &block)
|
45
|
+
log :fatal, *args, &block
|
46
46
|
end
|
47
47
|
|
48
48
|
LOG_LEVEL_QUERY_METHODS.each do |method|
|
@@ -53,8 +53,8 @@ class Logasm
|
|
53
53
|
|
54
54
|
private
|
55
55
|
|
56
|
-
def log(level, *args)
|
57
|
-
data = parse_log_data(*args)
|
56
|
+
def log(level, *args, &block)
|
57
|
+
data = parse_log_data(*args, &block)
|
58
58
|
processed_data = preprocess(data)
|
59
59
|
|
60
60
|
@adapters.each do |adapter|
|
@@ -68,9 +68,9 @@ class Logasm
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
def parse_log_data(message, metadata = {})
|
71
|
+
def parse_log_data(message = nil, metadata = {}, &block)
|
72
72
|
return message if message.is_a?(Hash)
|
73
73
|
|
74
|
-
(metadata || {}).merge(message: message)
|
74
|
+
(metadata || {}).merge(message: block ? block.call : message)
|
75
75
|
end
|
76
76
|
end
|
data/logasm.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "logasm"
|
7
|
-
gem.version = '0.4.
|
7
|
+
gem.version = '0.4.1'
|
8
8
|
gem.authors = ["Salemove"]
|
9
9
|
gem.email = ["support@salemove.com"]
|
10
10
|
gem.description = %q{It's logasmic}
|
data/spec/logasm_spec.rb
CHANGED
@@ -98,6 +98,20 @@ describe Logasm do
|
|
98
98
|
|
99
99
|
logasm.info 'test message', test: 'data'
|
100
100
|
end
|
101
|
+
|
102
|
+
it 'parses block as a message' do
|
103
|
+
message = 'test message'
|
104
|
+
expect(adapter).to receive(:log).with(:info, message: message)
|
105
|
+
|
106
|
+
logasm.info { message }
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'ignores progname on block syntax' do
|
110
|
+
message = 'test message'
|
111
|
+
expect(adapter).to receive(:log).with(:info, message: message)
|
112
|
+
|
113
|
+
logasm.info('progname') { message }
|
114
|
+
end
|
101
115
|
end
|
102
116
|
|
103
117
|
context 'log level queries' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salemove
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inflecto
|
@@ -78,7 +78,6 @@ files:
|
|
78
78
|
- ".ruby-gemset"
|
79
79
|
- ".ruby-version"
|
80
80
|
- Gemfile
|
81
|
-
- Gemfile.lock
|
82
81
|
- README.md
|
83
82
|
- Rakefile
|
84
83
|
- lib/logasm.rb
|
@@ -124,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
123
|
version: '0'
|
125
124
|
requirements: []
|
126
125
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.5.1
|
128
127
|
signing_key:
|
129
128
|
specification_version: 4
|
130
129
|
summary: What description said
|
data/Gemfile.lock
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
logasm (0.2.6)
|
5
|
-
inflecto
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
amq-protocol (2.0.0)
|
11
|
-
atomic (1.1.99)
|
12
|
-
bunny (1.6.3)
|
13
|
-
amq-protocol (>= 1.9.2)
|
14
|
-
coderay (1.1.0)
|
15
|
-
diff-lcs (1.2.5)
|
16
|
-
freddy (0.4.2)
|
17
|
-
bunny (= 1.6.3)
|
18
|
-
hamster (~> 1.0.1.pre.rc3)
|
19
|
-
symbolizer
|
20
|
-
thread (~> 0.2)
|
21
|
-
hamster (1.0.1.pre.rc3)
|
22
|
-
atomic (~> 1.1)
|
23
|
-
inflecto (0.0.2)
|
24
|
-
method_source (0.8.2)
|
25
|
-
pry (0.10.1)
|
26
|
-
coderay (~> 1.1.0)
|
27
|
-
method_source (~> 0.8.1)
|
28
|
-
slop (~> 3.4)
|
29
|
-
rake (10.3.2)
|
30
|
-
rspec (3.3.0)
|
31
|
-
rspec-core (~> 3.3.0)
|
32
|
-
rspec-expectations (~> 3.3.0)
|
33
|
-
rspec-mocks (~> 3.3.0)
|
34
|
-
rspec-core (3.3.2)
|
35
|
-
rspec-support (~> 3.3.0)
|
36
|
-
rspec-expectations (3.3.1)
|
37
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.3.0)
|
39
|
-
rspec-mocks (3.3.2)
|
40
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.3.0)
|
42
|
-
rspec-support (3.3.0)
|
43
|
-
slop (3.6.0)
|
44
|
-
symbolizer (0.0.1)
|
45
|
-
thread (0.2.2)
|
46
|
-
|
47
|
-
PLATFORMS
|
48
|
-
ruby
|
49
|
-
|
50
|
-
DEPENDENCIES
|
51
|
-
bundler (~> 1.3)
|
52
|
-
freddy (~> 0.4.1)
|
53
|
-
logasm!
|
54
|
-
pry
|
55
|
-
rake
|
56
|
-
rspec
|
57
|
-
|
58
|
-
BUNDLED WITH
|
59
|
-
1.10.6
|