rack-logs 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/logs/version.rb +1 -1
- data/lib/rack/logs/viewer.rb +19 -0
- 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: e9fef0a4a7ba691f8d17d6cff1fd00791d5f2a05
|
4
|
+
data.tar.gz: 9971a3879493d5e614798680b7b65eb7979ac030
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b89edfd6fcc0093668ee4430f896cf36990f35a2c809b87b1e9f537a1c691cd2cbdce7db9bbf1fd2240b8730b31ae7add8f1e2c740ee6d9857a2935676f291a
|
7
|
+
data.tar.gz: 791b88904009d3ed8340a737931019ae065fd9cca697b588389a88fb1b1ee94153e912e2ac340fc20f1a40e1eb4207cbbc7f582a2b6394d13e5759e33fc66bb7
|
data/lib/rack/logs/version.rb
CHANGED
data/lib/rack/logs/viewer.rb
CHANGED
@@ -53,6 +53,25 @@ module Rack
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def tail file, n
|
60
|
+
index = 1
|
61
|
+
lines = 0
|
62
|
+
buffer = ""
|
63
|
+
|
64
|
+
begin
|
65
|
+
file.seek(index * (1024 * -1), :END)
|
66
|
+
chunk = file.read(1024)
|
67
|
+
lines += chunk.count("\n")
|
68
|
+
buffer.prepend chunk
|
69
|
+
index += 1
|
70
|
+
end while lines < n && file.pos >= 0
|
71
|
+
|
72
|
+
buffer.lines[-1 * n].join
|
73
|
+
end
|
74
|
+
|
56
75
|
end
|
57
76
|
|
58
77
|
def joined_logs path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-logs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Rowe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|