logviewer 1.5.0 → 1.5.7
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 +10 -15
- 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: 0b2114d40916c4035ec2d6073e0bc07530fccda6d43662e1c0f15e46d2c5b053
|
4
|
+
data.tar.gz: 9bb090e8c537e956124225447d26d875e77e52f119671a3244db27049595c077
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16968466a7abbed8986d033d090101f8e56fe9b2e080e6374bc558b469bfd78368a35592af1e2f51d13e8759bedc3dd34b4155344065f94c329e9debbaaac23c
|
7
|
+
data.tar.gz: 0e97e00b01233e994316d7cbad5343fd60f5e93ae0379b325ca95e8036af79c0046c121cb2db4ae654c1a56b2848ba2b1f1edcce6d75c5b6573bfb4feae04b08
|
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
|
@@ -183,6 +182,7 @@ module LogViewer
|
|
183
182
|
width: 100%;
|
184
183
|
border-collapse: collapse;
|
185
184
|
font-size: 18px;
|
185
|
+
table-layout: fixed;
|
186
186
|
}
|
187
187
|
th {
|
188
188
|
background: #e9ecef;
|
@@ -208,9 +208,9 @@ module LogViewer
|
|
208
208
|
white-space: nowrap;
|
209
209
|
}
|
210
210
|
.text {
|
211
|
-
min-width: 600px;
|
212
211
|
word-wrap: break-word;
|
213
212
|
white-space: pre-wrap;
|
213
|
+
width: auto;
|
214
214
|
}
|
215
215
|
.file {
|
216
216
|
font-family: 'Monaco', 'Menlo', monospace;
|
@@ -224,6 +224,9 @@ module LogViewer
|
|
224
224
|
font-size: 16px;
|
225
225
|
color: #333;
|
226
226
|
font-weight: 500;
|
227
|
+
max-width: 300px;
|
228
|
+
word-wrap: break-word;
|
229
|
+
overflow-wrap: break-word;
|
227
230
|
}
|
228
231
|
.timestamp {
|
229
232
|
font-family: 'Monaco', 'Menlo', monospace;
|
@@ -237,12 +240,7 @@ module LogViewer
|
|
237
240
|
color: #007acc;
|
238
241
|
font-weight: 500;
|
239
242
|
}
|
240
|
-
|
241
|
-
font-family: 'Monaco', 'Menlo', monospace;
|
242
|
-
font-size: 16px;
|
243
|
-
color: #999;
|
244
|
-
text-align: right;
|
245
|
-
}
|
243
|
+
|
246
244
|
.empty {
|
247
245
|
color: #999;
|
248
246
|
font-style: italic;
|
@@ -259,13 +257,12 @@ module LogViewer
|
|
259
257
|
<table>
|
260
258
|
<thead>
|
261
259
|
<tr>
|
262
|
-
<th style="width: 120px;">
|
260
|
+
<th style="width: 120px;">Date</th>
|
263
261
|
<th style="width: 80px;">Level</th>
|
264
262
|
<th style="width: 120px;">Tag</th>
|
265
|
-
<th>Text</th>
|
266
263
|
<th style="width: 180px;">File</th>
|
267
|
-
<th style="width:
|
268
|
-
<th style="width:
|
264
|
+
<th style="width: 300px;">Function</th>
|
265
|
+
<th style="width: auto;">Text</th>
|
269
266
|
</tr>
|
270
267
|
</thead>
|
271
268
|
<tbody>
|
@@ -279,7 +276,6 @@ module LogViewer
|
|
279
276
|
text_content = log[:text].empty? ? '<span class="empty">-</span>' : log[:text]
|
280
277
|
filename = extract_filename(log[:file])
|
281
278
|
file_content = filename.empty? ? '<span class="empty">-</span>' : filename
|
282
|
-
line_content = log[:line].nil? ? '<span class="empty">-</span>' : log[:line]
|
283
279
|
method_content = log[:method].empty? ? '<span class="empty">-</span>' : log[:method]
|
284
280
|
|
285
281
|
html += <<~HTML
|
@@ -287,10 +283,9 @@ module LogViewer
|
|
287
283
|
<td class="timestamp">#{timestamp_content}</td>
|
288
284
|
<td class="level" style="#{level_style}">#{log[:level]}</td>
|
289
285
|
<td class="tag">#{tag_content}</td>
|
290
|
-
<td class="text">#{text_content}</td>
|
291
286
|
<td class="file">#{file_content}</td>
|
292
|
-
<td class="line">#{line_content}</td>
|
293
287
|
<td class="method">#{method_content}</td>
|
288
|
+
<td class="text">#{text_content}</td>
|
294
289
|
</tr>
|
295
290
|
HTML
|
296
291
|
end
|