logviewer 2.2.1 → 2.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37b1f60d724296d87e4a39a682f4403d066e62903d2b4cb6e4e96a1403b452b1
4
- data.tar.gz: 2bde00db4ffbb7f8db5e27501e9d1d29d56a54d89da61139106d22c0ff600b72
3
+ metadata.gz: db20f0ad40b118ced0a130ca5e0b666906a4c20e6faaa175464c6df82239b3fa
4
+ data.tar.gz: 76746d8d2099a5da7a7039f7e57726789d42668e6086246cf7385b43df738191
5
5
  SHA512:
6
- metadata.gz: 3d719a9c56cf246d6ab8c67f8e26f307582f2c223710f3b5ca7a6c9154d2d22d23a0b1ee047f88e174ce8a9dbfaa796ef1e7e74d3d87de6db6e5d3169cf00bbb
7
- data.tar.gz: 9cb4fc5aae64d63a48cfe9f3781ca21d92095310fcc2a1bde77fab7e9675c41eb93e2a9cee4f29e0882f71c8837380bd3e4ca87dcf87db92c4d0e02f178f63f1
6
+ metadata.gz: 527362782f4b033f386352c35c45306e3bce12582a4c715ee7b1d02284e52c4b2127936575d5166f9c92615143c91d2fba173f1d38def67fd90e87f17b5315d0
7
+ data.tar.gz: 9c94b35d24675ab718b2333d76b362ea6b6cb1c92035974a5b742450538ecad843dff8008a29133047673c0f1015398d37e982164fa472886a897ffbd8a77af7
data/README.md CHANGED
@@ -6,7 +6,7 @@ A Ruby gem that converts NDJSON log files into a readable HTML format for easy v
6
6
 
7
7
  - Converts NDJSON log files to HTML tables
8
8
  - Filters logs by minimum level (trace, debug, info, notice, warning, error, critical)
9
- - Displays key fields: date, level, tag, file, function, and text
9
+ - Displays key fields: date, level, tag, file, line, function, and text
10
10
  - Human-readable timestamp formatting (MM/DD HH:MM:SS)
11
11
  - Simplified file paths (shows only filename, not full path)
12
12
  - Color-coded log levels for easy identification
@@ -105,7 +105,7 @@ Example log entry:
105
105
 
106
106
  The generated HTML file will be saved in `/tmp/` with a timestamp and automatically opened in your browser. The HTML includes:
107
107
 
108
- - A wide, responsive table layout (1800px max width) with columns in order: date, level, tag, file, function, text
108
+ - A wide, responsive table layout (2000px max width) with columns in order: date, level, tag, file, line, function, text
109
109
  - Interactive log level filtering dropdown for dynamic filtering in the browser
110
110
  - Multi-select tag filter to show only specific subsystem/category combinations
111
111
  - Dark mode theme with comfortable dark backgrounds and light text
@@ -116,7 +116,7 @@ The generated HTML file will be saved in `/tmp/` with a timestamp and automatica
116
116
  - Large fonts (18px base size) for excellent readability
117
117
  - Simplified file display (filename only, not full paths)
118
118
  - Optimized column widths with expanded text area for log messages
119
- - Date, file, and function names in monospace font
119
+ - Date, file, line, and function names in monospace font
120
120
  - Color-coded tags for easy categorization
121
121
 
122
122
  ## Interactive Features
@@ -1,3 +1,3 @@
1
1
  module LogViewer
2
- VERSION = "2.2.1"
2
+ VERSION = "2.3.3"
3
3
  end
data/lib/logviewer.rb CHANGED
@@ -21,6 +21,7 @@ module LogViewer
21
21
  @args = args
22
22
  @min_level = 'trace'
23
23
  @input_file = nil
24
+ @tail_count = nil
24
25
  end
25
26
 
26
27
  def parse_options
@@ -38,6 +39,14 @@ module LogViewer
38
39
  end
39
40
  end
40
41
 
42
+ opts.on('-n', '--tail COUNT', Integer, 'Show only the most recent N log entries') do |count|
43
+ if count <= 0
44
+ puts "Error: tail count must be a positive integer"
45
+ exit 1
46
+ end
47
+ @tail_count = count
48
+ end
49
+
41
50
  opts.on('-v', '--version', 'Show version') do
42
51
  puts "logviewer #{LogViewer::VERSION}"
43
52
  exit
@@ -102,6 +111,7 @@ module LogViewer
102
111
  tag: tag_string,
103
112
  text: log_entry['message'] || '',
104
113
  file: log_entry['file'] || '',
114
+ line: log_entry['line'],
105
115
  method: log_entry['function'] || ''
106
116
  }
107
117
  end
@@ -168,7 +178,7 @@ module LogViewer
168
178
  color: #e0e0e0;
169
179
  }
170
180
  .container {
171
- max-width: 1800px;
181
+ max-width: 2000px;
172
182
  margin: 0 auto;
173
183
  background: #2d2d2d;
174
184
  border-radius: 8px;
@@ -258,6 +268,12 @@ module LogViewer
258
268
  word-wrap: break-word;
259
269
  overflow-wrap: break-word;
260
270
  }
271
+ .line {
272
+ font-family: 'Monaco', 'Menlo', monospace;
273
+ font-size: 16px;
274
+ color: #999;
275
+ text-align: right;
276
+ }
261
277
 
262
278
  .empty {
263
279
  color: #777;
@@ -308,6 +324,7 @@ module LogViewer
308
324
  <th style="width: 80px;">Level</th>
309
325
  <th style="width: 120px;">Tag</th>
310
326
  <th style="width: 180px;">File</th>
327
+ <th style="width: 60px;">Line</th>
311
328
  <th style="width: 300px;">Function</th>
312
329
  <th style="width: auto;">Text</th>
313
330
  </tr>
@@ -323,6 +340,7 @@ module LogViewer
323
340
  text_content = log[:text].empty? ? '<span class="empty">-</span>' : log[:text]
324
341
  filename = extract_filename(log[:file])
325
342
  file_content = filename.empty? ? '<span class="empty">-</span>' : filename
343
+ line_content = log[:line].nil? ? '<span class="empty">-</span>' : log[:line]
326
344
  method_content = log[:method].empty? ? '<span class="empty">-</span>' : log[:method]
327
345
 
328
346
  html += <<~HTML
@@ -331,6 +349,7 @@ module LogViewer
331
349
  <td class="level" style="#{level_style}">#{log[:level]}</td>
332
350
  <td class="tag">#{tag_content}</td>
333
351
  <td class="file">#{file_content}</td>
352
+ <td class="line">#{line_content}</td>
334
353
  <td class="method">#{method_content}</td>
335
354
  <td class="text">#{text_content}</td>
336
355
  </tr>
@@ -442,7 +461,14 @@ module LogViewer
442
461
  puts "Minimum log level: #{@min_level}"
443
462
 
444
463
  logs = parse_logs
445
- puts "Found #{logs.length} log entries matching criteria"
464
+
465
+ # Apply tail limit if specified
466
+ if @tail_count && logs.length > @tail_count
467
+ logs = logs.last(@tail_count)
468
+ puts "Found #{logs.length} log entries (showing most recent #{@tail_count})"
469
+ else
470
+ puts "Found #{logs.length} log entries matching criteria"
471
+ end
446
472
 
447
473
  if logs.empty?
448
474
  puts "No log entries found matching the specified criteria."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logviewer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Bishop