Skip to content

fix: improve Apex log detection robustness#729

Merged
lcottercertinia merged 2 commits intocertinia:mainfrom
lukecotter:fix-apex-log-detection
Feb 12, 2026
Merged

fix: improve Apex log detection robustness#729
lcottercertinia merged 2 commits intocertinia:mainfrom
lukecotter:fix-apex-log-detection

Conversation

@lukecotter
Copy link
Copy Markdown
Contributor

📝 PR Overview

Improves Apex debug log detection to handle more real-world log formats — including logs with preamble text, missing API version prefixes, and logs that start with USER_INFO or EXECUTION_STARTED instead of the settings header. Also places the log duration decoration on the first valid log line rather than always line 0.

🛠️ Changes made

  • Broaden ApexLogLanguageDetector to detect logs by EXECUTION_STARTED and USER_INFO lines, not just the settings header
  • Make settings header regex optional for API version prefix (e.g. APEX_CODE,FINE;... without 64.0 prefix)
  • Handle CRLF line endings in file-based detection (isApexLogFile)
  • Remove firstLine from package.json language contribution (detection is now content-based)
  • Add findFirstLogLine helper in LogTimingDecoration to place duration ghost text on the actual first log line
  • Export APEXLOG_HEADER regex for reuse across modules
  • Add comprehensive tests for isApexLogContent with 7 test cases covering standard, preamble, headerless, and negative scenarios

🧩 Type of change (check all applicable)

  • 🐛 Bug fix - something not working as expected
  • ✨ New feature – adds new functionality

🔗 Related Issues

N/A

✅ Tests added?

  • 👍 yes - added ApexLogLanguageDetector.test.ts

📚 Docs updated?

  • 🙅 not needed

This will probably be the log levels line ut if not present will be placed on the first line with timestamp.
@lcottercertinia lcottercertinia merged commit ae4dc98 into certinia:main Feb 12, 2026
5 checks passed
@lukecotter lukecotter deleted the fix-apex-log-detection branch February 12, 2026 15:40
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

Successfully merging this pull request may close these issues.

2 participants