KirillOsenkov / MSBuildStructuredLog

A logger for MSBuild that records a structured representation of executed targets, tasks, property and item values.
MIT License
1.41k stars 188 forks source link

Filter entries that are too old or too new? #722

Closed Seikilos closed 7 months ago

Seikilos commented 7 months ago

I have a log file that is very large and a build-error that indicates that something else is accessing the resource at the time.

Now I know that the failed task started at 2023-11-14 16:36:49.6033103 and ended at 2023-11-14 16:36:50.2594049. Is there a way to get only tasks whose start is < startDate and whose end date is > endDate ?

I have trouble to create the proper filter and do not know, whether I lack documentation or knowledge or whether the structure log does not support it.

KirillOsenkov commented 7 months ago

Right now we only have a way of listing tasks with their start and/or end times. You can append $start, $end or $time to any query to display start or end times or duration for projects, targets or tasks.

For example: $task $start

Sounds like a good idea to include date/time comparisons like you're suggesting.

KirillOsenkov commented 7 months ago

OK I implemented the following syntax:

image

You can use any combination of start<, start>, end< and end>:

start<"2023-11-17 16:56:20.6915121"
start>"2023-11-17 16:56:20.6915121"
end<"2023-11-17 16:56:20.6915121"
end>"2023-11-17 16:56:20.6915121"

The date needs to be in the same format as what Show time and duration right-click context menu shows you for projects, targets and tasks, surrounded with double-quotes. There may be a single space before or after <, but it's not required.

Comparisons are actually inclusive, so they're really <= and >=.

KirillOsenkov commented 7 months ago

I will deploy this new feature in the coming days, but if you wanted to try it out sooner, you can build the latest main branch yourself.

KirillOsenkov commented 7 months ago

I dunno, should I add proper support for < and <=, because currently the syntax is < and the semantics are <=. But seems like this covers the real-world cases, not sure I want to make this complicated.

Seikilos commented 7 months ago

I dunno, should I add proper support for < and <=, because currently the syntax is < and the semantics are <=. But seems like this covers the real-world cases, not sure I want to make this complicated.

I would pick one of them and make syntax and semantics consistent. This avoids needless questions about why it behaves different than expected

KirillOsenkov commented 7 months ago

I published an update with this functionality now.