Kittyfisto / Tailviewer

Open source log file viewer
https://kittyfisto.github.io/Tailviewer/
MIT License
200 stars 37 forks source link

Add filter to follow last occurence of an event and pin to top #211

Open BenKenobi85 opened 5 years ago

BenKenobi85 commented 5 years ago

introduction

Writing a measurement application using an API to control a mobile network scanner often involves to log certain characteristics of the network, for example signal strength and quality, to a log file. Besides some other, the log statements for signal strength and quality occur in a repetitive pattern, e.g. as often as the receiver sends an update, see the following example (marked by <-- update {1, 2, 3})

Example content of a receiver log file (including line numbers)

 1: lorem ipsum lorem ipsum
 2: lorem ipsum lorem ipsum
 3: measurement result no. 158: <-- update 1
 4:     cell 1: level = -60 dBm, quality = +5 dB 
 5:     cell 2: level = -80 dBm, quality = +1 dB 
 6: lorem ipsum lorem ipsum
 7: measurement result no. 159: <-- update 2
 8:     cell 1: level = -61 dBm, quality = +6 dB 
 9: measurement result no. 160: <-- update 3
10:     cell 1: level = -58 dBm, quality = +4 dB 
11: lorem ipsum lorem ipsum
12: lorem ipsum lorem ipsum

As a user of the network scanner I'm mainly interested in getting updates to measurement results, e.g. I want to see changes over time.

feature description

The wanted feature is a functionality to still follow the tail of the log but but to do it such way that the last occurrence of the measurement report is pinned to the top row of the text window of tailviewer (TV). The next section shows how consecutive updates to the TV display could look like.

how update shall look like in tailviewer

Updates before the specific event occurs Each log statements are added the usual way, one after each other. Follow tail feature still works as is.

 1: lorem ipsum lorem ipsum
 2: lorem ipsum lorem ipsum

First occurrence of the wanted event Log statement of the specific event is moved to top, e.g. line 3 is the first visible line in TV now.

 3: measurement result no. 158: <-- update 1

Log statements after the first wanted event After the first event following log statements fill the TV display in the follow tail way, e.g. added to end. Top line of TV is fixed to the first occurrence of the wanted event.

 3: measurement result no. 158: <-- update 1
 4:     cell 1: level = -60 dBm, quality = +5 dB 
 5:     cell 2: level = -80 dBm, quality = +1 dB 
 6: lorem ipsum lorem ipsum

Second occurrence of wanted event

 7: measurement result no. 159: <-- update 2

Log statements after the second wanted event

 7: measurement result no. 159: <-- update 2
 8:     cell 1: level = -61 dBm, quality = +6 dB 

Log statements after the third wanted event

 9: measurement result no. 160: <-- update 3
10:     cell 1: level = -58 dBm, quality = +4 dB 
11: lorem ipsum lorem ipsum
12: lorem ipsum lorem ipsum
Kittyfisto commented 5 years ago

Thanks for the detailed writeup. I think this should be doable. No ETA just yet ;)