tailog 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGU3ODNiNTE4MDdhNTIwNDEzYjYwNWIxNmY1YjZiMmYyZGM1MmI2MQ==
4
+ OGY5OGFkMjMyZTRiY2IzYjI0YTYxNmNkNTFkMmY0OWM1ZjYxNGZiMw==
5
5
  data.tar.gz: !binary |-
6
- YWNhZDliODQ4ODRhOGRmYzFmYzJhM2YzNjFhNWU0NmUyM2I5YzJmNQ==
6
+ NzM5MTlhNzc0ZGZmZTljZTk1N2U5YWNjYWNmMTJiYzU5MTkxZTFhMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODY2OTBiNGEyYTYwYmI1ZDAyMjM2MGM0NzQ1Zjc0MTFjNTQ4MDc1NjRiNWIx
10
- YzE1ZjY4MzIzM2M2YWFmODRmNjhhOGFjNDljMTc1ZjdkZmJjMWU3YzU5NTBk
11
- MWM5OTZlZDIwMGU4NDk3NTdlZGY4Yjg3MjQ3NzM4YWFiYWY2Mjg=
9
+ M2U1YjAyNGY4ZjViMGNkNzBlOTY3NGFjMmZiMGExNDdjOWE1MTliNjZjZTlk
10
+ MThiYWU4ZTBiYjdjY2Y0ZmUzZmJjN2ZjNTgyNDI2NzZjYjQzYTkyODNmODA4
11
+ NjIyOWY3NmExYTE5ODkwNDVmNjRiYjdiMzgxY2FjMmFmOTYyYTA=
12
12
  data.tar.gz: !binary |-
13
- ZDQ3ZTRlYjUzMTJiYjhjMGM0NmVhZDQ3ZjUwYmNmOWY5N2RmYjljZWU0MzUz
14
- OGYxZDJmM2JlNGExODVhOGU2N2NiNzc4MWY1NmU2YTJlNjcyYTAwY2I5OWQ3
15
- ZmYyOTUyNzM1OTQ5NTlhMjE4ZDk3NDg1ODZiNmY5ZGMyYjg2NTI=
13
+ Y2JiNDE2ZTRlMDc5YjM5NjQwMDdiMzI5MWY1NWMwMWJmMTVmOTEzOTIyYTYx
14
+ YWFjNzViNzAyYWFkMGVmNjg0ZTg3MzYxZGE1NzE2ODhkZjEzMjQ4Nzk5ZmQ1
15
+ MmI2MTg3NjRhZGRiMzkyNjJjMTU0ZDI4MDk1MTA5YmVmNDBhMmQ=
data/README.md CHANGED
@@ -23,6 +23,8 @@ Or install it yourself as:
23
23
  In `config.ru`
24
24
 
25
25
  ```ruby
26
+ require 'tailog'
27
+
26
28
  run Rack::URLMap.new(
27
29
  '/' => Your::App,
28
30
  '/tailog' => Tailog::App
data/app/views/ajax.erb CHANGED
@@ -11,5 +11,10 @@
11
11
  </script>
12
12
  <% end %>
13
13
  <% rescue => error %>
14
- <div class="alert alert-danger"><%= h error.message %></div>
14
+ <div class="alert alert-danger">
15
+ <h4><%= h error.class %>: <%= h error.message %></h4>
16
+ <% error.backtrace.each do |backtrace| %>
17
+ <%= h backtrace %><br>
18
+ <% end %>
19
+ </div>
15
20
  <% end %>
data/app/views/index.erb CHANGED
@@ -22,6 +22,10 @@
22
22
  p:hover {
23
23
  background: #EEE;
24
24
  }
25
+
26
+ a {
27
+ display: block;
28
+ }
25
29
  </style>
26
30
  </head>
27
31
  <body>
@@ -90,14 +94,27 @@
90
94
  $(data).appendTo($content);
91
95
  }
92
96
  });
93
- }, 1000);
97
+ }, 3000);
94
98
  </script>
95
99
 
96
100
  <% end %>
97
101
 
98
102
  <% rescue => error %>
99
- <div class="alert alert-danger"><%= h error.message %></div>
103
+ <div class="alert alert-danger">
104
+ <h4><%= h error.class %>: <%= h error.message %></h4>
105
+ <% error.backtrace.each do |backtrace| %>
106
+ <%= h backtrace %><br>
107
+ <% end %>
108
+ </div>
100
109
  <% end %>
110
+
111
+ <% else %>
112
+ <div id="content" class="monospace">
113
+ <% Dir[File.join Tailog.log_path, '**/*.log'].each do |file| %>
114
+ <% relative_file = Pathname.new(file).relative_path_from(Pathname.new(Tailog.log_path)) %>
115
+ <a href="?file=<%= relative_file %>"><%= file %></a>
116
+ <% end %>
117
+ </div>
101
118
  <% end %>
102
119
 
103
120
  </div> <!-- /container -->
@@ -1,3 +1,3 @@
1
1
  module Tailog
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/tailog.rb CHANGED
@@ -12,6 +12,7 @@ class File
12
12
  begin
13
13
  seek(idx)
14
14
  chunk = read(buffer)
15
+ break unless chunk
15
16
  lines += chunk.count("\n")
16
17
  chunks.unshift chunk
17
18
  idx -= buffer
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tailog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bbtfr