Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support logs with multiple lines #216

Open
bdovaz opened this issue Oct 11, 2024 · 1 comment
Open

Support logs with multiple lines #216

bdovaz opened this issue Oct 11, 2024 · 1 comment

Comments

@bdovaz
Copy link

bdovaz commented Oct 11, 2024

In our case, we have logs that either by our code or third parties, the reality is that they can generate multi-line logs.

For example, for a log to output a stacktrace:

2024-01-01 12:00:00,000 [1] DBG [TestClass] - A text
other text
other text2
2024-01-01 12:00:00,000 [1] DBG [TestClass] - A text 2
other text3
other text4

The problem comes that although my regex works in regex101.com, I see that the implementation makes it read the file line by line and execute the regex line by line instead of as a whole:

while ((currentLine = await streamReader.ReadLineAsync().ConfigureAwait(false)) != null)

This makes my regex not work obviously because it expects the input of the regex to be the content of the whole file and not line by line.

Would it be possible to support this different behavior when executing the regex? I know that the feedback is not the same because by not reading line by line you can't report progress (messagesHandler.ReportFileReadProgress()). But we are talking about that not all log files size is 100MB or more.

If so I could lend a hand with a PR if needed.

Thank you.

@LiorBanai
Copy link
Member

Each data provider factory can have multiple different parser so this can be an addition to the existing one:

new List<IAnalogyDataProvider> { new RegexOfflineDataProvider() };

we can can create new provider, something like RegexFullFileOfflineDataProvider. You can implement it in a pr if you wish or I will try to get to it next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants