logviewer 1.5.0 → 1.5.1
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 +4 -4
- data/README.md +5 -6
- data/lib/logviewer/version.rb +1 -1
- data/lib/logviewer.rb +5 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8784d7513678b085069d4383c9aaed89a93e3e542bc6a053754ccb0814ef784
|
4
|
+
data.tar.gz: 9beac9a4fd089a81ea1f5dd7305ab69813b830e136b954b93899965fe9ff500f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84ac955ffd0d95dcc1f2d3f554911500e616a328bcde2398d80ec9d2fe552a78885c588520b2863e9b99bf28ba2547ee1a5c54ddb2736452a109de80a431cdaf
|
7
|
+
data.tar.gz: ab97e9be8d51a702896c5309422599c55d9ba45b30ee2ffe8e23802817e98779f87220ff48e59ee88f3baec1c9bae1cee16ccf1d75614dbcd1698d31c3926444
|
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, warning, error, fatal)
|
9
|
-
- Displays key fields:
|
9
|
+
- Displays key fields: date, level, tag, file, 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
|
@@ -87,24 +87,23 @@ logviewer --version
|
|
87
87
|
|
88
88
|
The tool expects NDJSON (newline-delimited JSON) files where each line contains a JSON object with these fields:
|
89
89
|
|
90
|
-
- `timestamp`: ISO 8601 timestamp (e.g., "2025-06-02T18:22:48.855-07:00")
|
90
|
+
- `timestamp`: ISO 8601 timestamp (e.g., "2025-06-02T18:22:48.855-07:00") (displayed as MM/DD HH:MM:SS)
|
91
91
|
- `level`: Log level (trace, debug, info, warning, error, fatal)
|
92
92
|
- `tag`: Category or module tag (e.g., "Play/manager")
|
93
93
|
- `text`: The log message
|
94
94
|
- `file`: Source file path (displayed as filename only)
|
95
|
-
- `line`: Line number in the source file
|
96
95
|
- `method`: Function/method name
|
97
96
|
|
98
97
|
Example log entry:
|
99
98
|
```json
|
100
|
-
{"timestamp":"2025-06-02T18:22:48.855-07:00","level":"info","tag":"Auth/manager","text":"User logged in successfully","file":"auth.rb","
|
99
|
+
{"timestamp":"2025-06-02T18:22:48.855-07:00","level":"info","tag":"Auth/manager","text":"User logged in successfully","file":"auth.rb","method":"login"}
|
101
100
|
```
|
102
101
|
|
103
102
|
## Output
|
104
103
|
|
105
104
|
The generated HTML file will be saved in `/tmp/` with a timestamp and automatically opened in your browser. The HTML includes:
|
106
105
|
|
107
|
-
- A wide, responsive table layout (1800px max width) with
|
106
|
+
- A wide, responsive table layout (1800px max width) with columns in order: date, level, tag, file, function, text
|
108
107
|
- Human-readable timestamps (MM/DD HH:MM:SS format)
|
109
108
|
- Color-coded log levels
|
110
109
|
- Sticky header for easy navigation
|
@@ -112,7 +111,7 @@ The generated HTML file will be saved in `/tmp/` with a timestamp and automatica
|
|
112
111
|
- Large fonts (18px base size) for excellent readability
|
113
112
|
- Simplified file display (filename only, not full paths)
|
114
113
|
- Optimized column widths with expanded text area for log messages
|
115
|
-
-
|
114
|
+
- Date, file, and function names in monospace font
|
116
115
|
- Color-coded tags for easy categorization
|
117
116
|
|
118
117
|
## Development
|
data/lib/logviewer/version.rb
CHANGED
data/lib/logviewer.rb
CHANGED
@@ -92,7 +92,6 @@ module LogViewer
|
|
92
92
|
tag: log_entry['tag'] || '',
|
93
93
|
text: log_entry['text'] || '',
|
94
94
|
file: log_entry['file'] || '',
|
95
|
-
line: log_entry['line'],
|
96
95
|
method: log_entry['method'] || ''
|
97
96
|
}
|
98
97
|
end
|
@@ -237,12 +236,7 @@ module LogViewer
|
|
237
236
|
color: #007acc;
|
238
237
|
font-weight: 500;
|
239
238
|
}
|
240
|
-
|
241
|
-
font-family: 'Monaco', 'Menlo', monospace;
|
242
|
-
font-size: 16px;
|
243
|
-
color: #999;
|
244
|
-
text-align: right;
|
245
|
-
}
|
239
|
+
|
246
240
|
.empty {
|
247
241
|
color: #999;
|
248
242
|
font-style: italic;
|
@@ -259,13 +253,12 @@ module LogViewer
|
|
259
253
|
<table>
|
260
254
|
<thead>
|
261
255
|
<tr>
|
262
|
-
<th style="width: 120px;">
|
256
|
+
<th style="width: 120px;">Date</th>
|
263
257
|
<th style="width: 80px;">Level</th>
|
264
258
|
<th style="width: 120px;">Tag</th>
|
265
|
-
<th>Text</th>
|
266
259
|
<th style="width: 180px;">File</th>
|
267
|
-
<th style="width:
|
268
|
-
<th
|
260
|
+
<th style="width: 100px;">Function</th>
|
261
|
+
<th>Text</th>
|
269
262
|
</tr>
|
270
263
|
</thead>
|
271
264
|
<tbody>
|
@@ -279,7 +272,6 @@ module LogViewer
|
|
279
272
|
text_content = log[:text].empty? ? '<span class="empty">-</span>' : log[:text]
|
280
273
|
filename = extract_filename(log[:file])
|
281
274
|
file_content = filename.empty? ? '<span class="empty">-</span>' : filename
|
282
|
-
line_content = log[:line].nil? ? '<span class="empty">-</span>' : log[:line]
|
283
275
|
method_content = log[:method].empty? ? '<span class="empty">-</span>' : log[:method]
|
284
276
|
|
285
277
|
html += <<~HTML
|
@@ -287,10 +279,9 @@ module LogViewer
|
|
287
279
|
<td class="timestamp">#{timestamp_content}</td>
|
288
280
|
<td class="level" style="#{level_style}">#{log[:level]}</td>
|
289
281
|
<td class="tag">#{tag_content}</td>
|
290
|
-
<td class="text">#{text_content}</td>
|
291
282
|
<td class="file">#{file_content}</td>
|
292
|
-
<td class="line">#{line_content}</td>
|
293
283
|
<td class="method">#{method_content}</td>
|
284
|
+
<td class="text">#{text_content}</td>
|
294
285
|
</tr>
|
295
286
|
HTML
|
296
287
|
end
|