carina-studio / ULogViewer

Cross-Platform Universal Log Viewer.
https://carina-studio.github.io/ULogViewer/
MIT License
409 stars 40 forks source link

Add support for exclusionary text filters #49

Closed acastruc closed 2 months ago

acastruc commented 2 months ago

This PR implements exclusionary text filters. The text filters that ULogViewer lets users create today are what I call 'inclusionary' - meaning if any one of the selected filter-pattens match then the log entry is displayed An exclusionary text filter is the opposite - if any of the exclusionary filter-patterns match then the log is not displayed. Useful for things like "Show me all logs except if it has 'foo' or 'bar'"

Right now the way to create an exclusionary text filter is to prefix the name with ‘!’ character. I recognize this is crude but it helped me get it working quickly. I can see a future change being to add a control in the text filter creation editor to mark something as “exclusionary” or not, rather than keying off the name.

Example: If my log file is this

image

I can select !Foo predefined pattern and it will exclude anything with Foo

image

If I select both !Foo and !Cat it will exlude both but show everything else:

image

Note there is nothing special about !Foo and !Cat - they have the patterns Foo and Cat respectively. I've just named them with '!' at the start and the program treats them as exclusionary patterns

image
hamster620 commented 2 months ago

I think we need an option in Create/Edit text filter dialog to set whether the filter is used for inclusion or exclusion. But we can merge your change first and do further modification based on your code.