carina-studio / ULogViewer

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

Question about Combination mode #45

Closed acastruc closed 2 months ago

acastruc commented 2 months ago

I am confused by some results I am seeing and I can't determine whether it's a bug or Im not understanding something. Docs describe combination mode intersection = AND union = OR Ok, that makes sense. So i have a test.log that I open under the ULogViewer profile

2024-09-02 13:20:24.3116 18492     1 INFO  Foo: [Performance] Took 434 ms to initialize Avalonia framework 
2024-09-02 13:20:25.0537 18492     1 DEBUG Bar: Check availability 
2024-09-02 13:20:25.1329 18492     1 DEBUG Bar: Change culture info to en-CA 
2024-09-02 13:20:25.1470 18492     1  WARN Cat: Unable to load string resource  
2024-09-02 13:20:28.2001 18492     1 TRACE FooCat: [Performance] Took 25 ms to create base theme  
2024-09-02 13:20:29.2001 18492     1 TRACE Dog: [Performance] Took 25 ms to create base theme  

I create 3 predefined filters

  1. Name: Foo, Regex: 'Foo'
  2. Name: Bar, Regex: 'Bar'
  3. Name: Cat, Regex: 'Cat'

If I activate (select) Foo filter, I only see the log lines that contain Foo (expected) If I set combination mode = UNION and I multiselect Foo and Cat filters, I see all the log lines, including Bar and Dog. I would expect to only see lines that contain Foo OR Cat, not all lines. If I set combination mode = INTERSECTION and I multiselect Foo and Cat filters, I see 3 lines: the one with Foo, the one with Cat, and the one with FooCat. This is the result I would expect for UNION, not intersection. For INTERSECTION I would expect to see the log lines that match on pattern Foo AND pattern Cat, meaning only lines that contain Foo AND Cat. But instead I see all lines.

hamster620 commented 2 months ago

@acastruc Combination mode works for combining Text filters and Other conditions (PID/TID/...). All text filters, including predefined, are combined in OR pattern.

acastruc commented 2 months ago

@hamster620 Thanks for clarifying. I guess that makes sense for regular (inclusionary) regex filters, i.e. where you're considering what to see. If any text filter matches, log is included. I've implemented exclusionary filter patterns, where if they match a log entry then it is NOT shown. I think in that case AND'ing the exclusionary filters makes sense. Do you agree? For exclusionary filter pattern matches, if any text filter matches, the log is excluded