Customize log regex for new filtering features
We love the addition of log filtering in 1.97 (https://code.visualstudio.com/updates/v1_97#_output-panel-filtering) however looking at the code it seems pretty much hardcoded to only support a single type of log format to extract log levels/categories.
We have a situation where we directly show in VSCode combined logs coming from multiple services which works great for "global" debugging but in our other user surfaces we allow folks to filter it down to specific services instead, something we were not able to do in VSCode until this feature.
It would be great to either extend the OutputChannel API or, alternatively, allow to extend the extraction process with custom regex so that we can easily support our use case rather than forcing us to adopt the currently hardcoded log format.
We have a situation where we directly show in VSCode combined logs coming from multiple services which works great for "global" debugging but in our other user surfaces we allow folks to filter it down to specific services instead, something we were not able to do in VSCode until this feature.
Can you please explain more about this scenario, giving an example would be helpful may be
@sandy081 for example this would be a log stream we have:
[16:13:54] service1: log line
[16:13:54] service1: log line
[16:13:54] service2: log line
[16:13:54] service3: log line
[16:13:54] service1: log line
[16:13:54] service2: log line
In all our other surfaces where we display such logs we can do filtering based on {service1, service2, service3} which I think would map well to the feature "category" (we would usually be bounded to maximum perhaps 10-15 of individual services displayed).
Given the log above (we would do it differently but for the sake of argument) it would be useful for instance to customize our OutputChannel instance to have a categoryRegex: '\[\d{2}:\d{2}:\d{2}\]\s(?<category>\w+):\s\w+' type of thing.
Have you tried change your log to print in following format?
2025-03-07 10:02:37.504 [info] [service1] log line
2025-03-07 10:02:37.505 [info] [service2] log line
Yes this would work but our log format is load bearing in other systems hence this ask to make the format recognized by VSCode customizable instead
Ah I see. Got it. But we would recommend to follow the VS Code format to benefit from the features OOB.
We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.
If you wonder what we are up to, please see our roadmap and issue reporting guidelines.
Thanks for your understanding, and happy coding!