tailog 0.4.8 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -0
- data/Rakefile +1 -1
- data/app/assets/stylesheets/application.css +1 -13
- data/app/views/env.erb +16 -6
- data/app/views/logs/index.erb +34 -4
- data/app/views/script/ruby.erb +5 -23
- data/lib/tailog/ext/integer.rb +11 -0
- data/lib/tailog/version.rb +1 -1
- data/lib/tailog.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fd13eb77482d1cfc13d6fd7bdf053372ea3e07c
|
4
|
+
data.tar.gz: 82e8eb42eeff66351af20e5313f233be08305657
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043d74d639c9e52b0f9160059a5d6dab788bcdc22af765b04de13f5423a9d6a05f6f166ba1504e418edf0f807221224dc0fe8c4484b28b415dc76f6677f59a62
|
7
|
+
data.tar.gz: 1fb5736d9bbe35af4cc5f3e49ffaea1373bf825cdfb1a9115d50927e5cf1d25c11838d2cd140c29ee7ab3a8263f418684f6c3e85ca02779421b01d4fa2dcd2d3
|
data/.travis.yml
ADDED
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
task :default => :
|
2
|
+
task :default => :build
|
@@ -40,22 +40,10 @@ p {
|
|
40
40
|
background: #EEE;
|
41
41
|
}
|
42
42
|
|
43
|
-
.
|
44
|
-
width: 320px;
|
45
|
-
padding-right: 20px;
|
46
|
-
overflow-x: scroll;
|
47
|
-
text-overflow: initial;
|
48
|
-
}
|
49
|
-
|
50
|
-
.dl-horizontal dd {
|
51
|
-
margin-left: 320px;
|
43
|
+
.table td:not(:first-child) {
|
52
44
|
word-break: break-all;
|
53
45
|
}
|
54
46
|
|
55
|
-
.dl-hover dt:hover + dd, .dl-hover dd:hover {
|
56
|
-
background: #EEE;
|
57
|
-
}
|
58
|
-
|
59
47
|
.script select.form-control {
|
60
48
|
display: inline-block;
|
61
49
|
width: 100px;
|
data/app/views/env.erb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
</
|
1
|
+
<table class="table table-striped table-hover">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>Key</th>
|
5
|
+
<th>Value</th>
|
6
|
+
</tr>
|
7
|
+
</thead>
|
8
|
+
<tbody>
|
9
|
+
<% ENV.each do |key, value| %>
|
10
|
+
<tr>
|
11
|
+
<td><%= key %></td>
|
12
|
+
<td><%= value %></td>
|
13
|
+
</tr>
|
14
|
+
<% end %>
|
15
|
+
</tbody>
|
16
|
+
</table>
|
data/app/views/logs/index.erb
CHANGED
@@ -110,12 +110,19 @@
|
|
110
110
|
$.post(window.location.href, { seek: window.fileSize }, function(json) {
|
111
111
|
try {
|
112
112
|
var data = JSON.parse(json);
|
113
|
+
var empty = !window.fileSize[data.server_hostname] && data.file_size === 0;
|
113
114
|
|
114
115
|
var fileSizeKey = data.server_hostname + '-' + data.file_size;
|
115
116
|
if (window.fileSizeDone[fileSizeKey]) return;
|
116
117
|
window.fileSizeDone[fileSizeKey] = true;
|
117
118
|
window.fileSize[data.server_hostname] = data.file_size;
|
118
119
|
|
120
|
+
if (empty) {
|
121
|
+
$content
|
122
|
+
.append('<span class="text-info">' + data.server_hostname + ' - ' + data.file_size + '</span>')
|
123
|
+
.append('<p><span class="text-danger">There is nothing in this file.</span></p>');
|
124
|
+
}
|
125
|
+
|
119
126
|
if (!data.content) return;
|
120
127
|
var shouldScrollToBottom = $window.scrollTop() + $window.height() == $document.height();
|
121
128
|
|
@@ -144,10 +151,33 @@
|
|
144
151
|
</script>
|
145
152
|
|
146
153
|
<% else %>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
154
|
+
<table class="table table-striped table-hover">
|
155
|
+
<thead>
|
156
|
+
<tr>
|
157
|
+
<th>File name</th>
|
158
|
+
<th>Size</th>
|
159
|
+
<th>Updated at</th>
|
160
|
+
</tr>
|
161
|
+
</thead>
|
162
|
+
<tbody>
|
163
|
+
<% Dir[File.join Tailog.log_path, '**/*.log'].each do |file| %>
|
164
|
+
<% relative_file = Pathname.new(file).relative_path_from(Pathname.new(Tailog.log_path)) %>
|
165
|
+
<% stat = File.stat(file) %>
|
166
|
+
|
167
|
+
<tr>
|
168
|
+
<td>
|
169
|
+
<a href="?file=<%= relative_file %>"><%= file %></a>
|
170
|
+
</td>
|
171
|
+
<td>
|
172
|
+
<%= stat.size.to_filesize %>
|
173
|
+
</td>
|
174
|
+
<td>
|
175
|
+
<%= stat.mtime %>
|
176
|
+
</td>
|
177
|
+
</tr>
|
178
|
+
<% end %>
|
179
|
+
</tbody>
|
180
|
+
</table>
|
151
181
|
<% end %>
|
152
182
|
|
153
183
|
<% rescue => error %>
|
data/app/views/script/ruby.erb
CHANGED
@@ -1,33 +1,15 @@
|
|
1
1
|
<% begin %>
|
2
2
|
|
3
|
-
<%
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def print *args
|
8
|
-
OUTPUT.print *args
|
9
|
-
end
|
10
|
-
|
11
|
-
def puts *args
|
12
|
-
OUTPUT.puts *args
|
13
|
-
end
|
14
|
-
|
15
|
-
def p *args
|
16
|
-
OUTPUT.puts *args.map(&:inspect)
|
17
|
-
end
|
18
|
-
|
19
|
-
%>
|
3
|
+
<% input = StringIO.new(script) %>
|
4
|
+
<% output = StringIO.new %>
|
5
|
+
<% binding = Object.new.send :binding %>
|
20
6
|
|
21
7
|
<% begin %>
|
22
|
-
<% binding
|
23
|
-
|
24
|
-
<% OUTPUT.string.each_line do |line| %>
|
25
|
-
<p><%= h line %></p>
|
26
|
-
<% end %>
|
8
|
+
<% Pry.start binding, input: input, output: output %>
|
9
|
+
<%= h output.string %>
|
27
10
|
<% rescue => error %>
|
28
11
|
<p class="text-danger"><%= h error.class %>: <%= h error.message %></p>
|
29
12
|
<% error.backtrace.each do |backtrace| %>
|
30
|
-
<% next unless backtrace.start_with? "(script)" %>
|
31
13
|
<p class="text-danger"> <%= h backtrace %></p>
|
32
14
|
<% end %>
|
33
15
|
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Integer
|
2
|
+
def to_filesize
|
3
|
+
{
|
4
|
+
'B' => 1024,
|
5
|
+
'KB' => 1024 * 1024,
|
6
|
+
'MB' => 1024 * 1024 * 1024,
|
7
|
+
'GB' => 1024 * 1024 * 1024 * 1024,
|
8
|
+
'TB' => 1024 * 1024 * 1024 * 1024 * 1024
|
9
|
+
}.each_pair { |e, s| return "#{(self.to_f / (s / 1024)).round(2)}#{e}" if self < s }
|
10
|
+
end
|
11
|
+
end
|
data/lib/tailog/version.rb
CHANGED
data/lib/tailog.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bbtfr
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -61,6 +61,7 @@ extra_rdoc_files: []
|
|
61
61
|
files:
|
62
62
|
- ".codeclimate.yml"
|
63
63
|
- ".gitignore"
|
64
|
+
- ".travis.yml"
|
64
65
|
- Gemfile
|
65
66
|
- LICENSE.md
|
66
67
|
- README.md
|
@@ -94,6 +95,7 @@ files:
|
|
94
95
|
- lib/tailog.rb
|
95
96
|
- lib/tailog/eval.rb
|
96
97
|
- lib/tailog/ext/file.rb
|
98
|
+
- lib/tailog/ext/integer.rb
|
97
99
|
- lib/tailog/request_id.rb
|
98
100
|
- lib/tailog/version.rb
|
99
101
|
- lib/tailog/watch_methods.rb
|