lines 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/CHANGELOG.md +8 -0
- data/lib/lines.rb +1 -1
- data/lib/lines/active_record.rb +2 -1
- data/lib/lines/rack_logger.rb +1 -0
- data/lib/lines/version.rb +1 -1
- data/spec/bench.rb +55 -0
- data/spec/lines_spec.rb +6 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzZjZDcxM2I5YjM2OTUyMmI2YmZlZmI2ZWRhNzgxMmJlNTVkM2E5MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGVhNDVhOTUyYzQzZDY3YTBiOWQ1NmExMTc4MTlhMWZkNGZiY2YxZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmYzMGZiNGVkOTAwZjJiY2ViOGY3OGI2NGYyYTYwZDRiNzU3MmZkMWViOGNh
|
10
|
+
ODYzZjJjNDRmNTA2NmM2ODA2MjY2ZmVhODhmMjcyZDQ1MjY5OTJlZjE1NDgw
|
11
|
+
N2Q2ZWQxYjk1OTJjYzRhNWQ0ZmE1OTZlMmEwMTJkMTkzNmZlYTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTU4N2I1MGUwYTM4ZTZhOWU2MGMzNjQwOGE3MWQzN2M1ODI2ZDQyZjQ4MmI4
|
14
|
+
ZWJiNWI3YTcxYzIwNWNjMzMyZGU1ZDE5NmZiZGRiMTUyMjUyYTllMDYzNzll
|
15
|
+
YmE1NDA3YjQ2ZjM2OGY5NTAwNWRjNGYyMGVlYjQ3MTM2MmM3ZWM=
|
data/CHANGELOG.md
ADDED
data/lib/lines.rb
CHANGED
data/lib/lines/active_record.rb
CHANGED
@@ -29,8 +29,9 @@ module Lines
|
|
29
29
|
Lines.log(name: event.payload[:name], line: event.payload[:line])
|
30
30
|
end
|
31
31
|
|
32
|
-
def logger;
|
32
|
+
def logger; Lines.logger; end
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
ActiveRecord::Base.logger = Lines.logger
|
36
37
|
Lines::ActiveRecordSubscriber.attach_to :active_record
|
data/lib/lines/rack_logger.rb
CHANGED
data/lib/lines/version.rb
CHANGED
data/spec/bench.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
require 'lines'
|
3
|
+
|
4
|
+
module Kernel
|
5
|
+
def bm(name = nil, &what)
|
6
|
+
start = Time.now.to_f
|
7
|
+
count = 0
|
8
|
+
max = 0.5
|
9
|
+
name ||= what.source_location.join(':')
|
10
|
+
$stdout.write "#{name} : "
|
11
|
+
while Time.now.to_f - start < max
|
12
|
+
yield
|
13
|
+
count += 1
|
14
|
+
end
|
15
|
+
$stdout.puts "%0.3f fps" % (count / max)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class FakeIO
|
20
|
+
def write(*a)
|
21
|
+
end
|
22
|
+
alias syswrite write
|
23
|
+
end
|
24
|
+
|
25
|
+
Lines.global[:app] = 'benchmark'
|
26
|
+
Lines.global[:at] = proc{ Time.now }
|
27
|
+
Lines.global[:pid] = Process.pid
|
28
|
+
|
29
|
+
EX = (raise "FOO" rescue $!)
|
30
|
+
|
31
|
+
Lines.use FakeIO.new
|
32
|
+
bm "FakeIO write" do
|
33
|
+
Lines.log EX
|
34
|
+
end
|
35
|
+
|
36
|
+
dev_null = File.open('/dev/null', 'w')
|
37
|
+
Lines.use dev_null
|
38
|
+
bm "/dev/null write" do
|
39
|
+
Lines.log EX
|
40
|
+
end
|
41
|
+
|
42
|
+
Lines.use Syslog
|
43
|
+
bm "syslog write" do
|
44
|
+
Lines.log EX
|
45
|
+
end
|
46
|
+
|
47
|
+
real_file = File.open('real_file.log', 'w')
|
48
|
+
Lines.use real_file
|
49
|
+
bm "real file" do
|
50
|
+
Lines.log EX
|
51
|
+
end
|
52
|
+
|
53
|
+
bm "real file logger" do
|
54
|
+
Lines.logger.info "Ahoi this is a really cool option"
|
55
|
+
end
|
data/spec/lines_spec.rb
CHANGED
@@ -90,6 +90,12 @@ describe Lines do
|
|
90
90
|
'count=2 msg=test2' + Lines::NL
|
91
91
|
)
|
92
92
|
end
|
93
|
+
|
94
|
+
it "doesn't fail if a proc has an exception" do
|
95
|
+
Lines.global[:X] = proc{ fail "error" }
|
96
|
+
Lines.log 'test'
|
97
|
+
expect(output).to eq("X='#<RuntimeError: error>' msg=test" + Lines::NL)
|
98
|
+
end
|
93
99
|
end
|
94
100
|
end
|
95
101
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lines
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Pfenniger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- .gitignore
|
49
49
|
- .rspec
|
50
50
|
- .travis.yml
|
51
|
+
- CHANGELOG.md
|
51
52
|
- Gemfile
|
52
53
|
- LICENSE.txt
|
53
54
|
- README.md
|
@@ -59,6 +60,7 @@ files:
|
|
59
60
|
- lib/lines/rack_logger.rb
|
60
61
|
- lib/lines/version.rb
|
61
62
|
- lines.gemspec
|
63
|
+
- spec/bench.rb
|
62
64
|
- spec/lines_loader_spec.rb
|
63
65
|
- spec/lines_spec.rb
|
64
66
|
- spec/spec_helper.rb
|
@@ -87,6 +89,7 @@ signing_key:
|
|
87
89
|
specification_version: 4
|
88
90
|
summary: Lines is an opinionated structured logging library
|
89
91
|
test_files:
|
92
|
+
- spec/bench.rb
|
90
93
|
- spec/lines_loader_spec.rb
|
91
94
|
- spec/lines_spec.rb
|
92
95
|
- spec/spec_helper.rb
|