Skip to content

Bring the log level annotations from main into caching1 - #3

Merged
tstack merged 10 commits into
caching1from
claude/project-thread-dj3xkq
Oct 26, 2026
Merged

tstack merged 10 commits into
caching1from
claude/project-thread-dj3xkq

Conversation

@tstack

@tstack tstack commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Requested by Tim · project thread

#2 (log levels on statements) was merged into main, but lnav builds against caching1, which has diverged a lot. This merges main into caching1 and resolves the conflicts so lnav can use the levels.

Conflict resolutions

  • compare_candidates() on caching1 is a free function used by the line cache, the prefilter matches, and link_to_source(). It now takes the message's level and prefers a statement with the same level right after quality (the same order as Annotate extracted log statements with their log level #2), before line distance, placeholder count, and location. The LogRef::compare_candidates() method from Annotate extracted log statements with their log level #2 is dropped.
  • Java statements whose message is a constant (MessageRef) carry the call's level too, so SourceRef::from_message_ref() sets it.
  • The level computation moved into QueryResult::level() so both paths share it.
  • The Java query keeps caching1's log(Level, String) and message-ref patterns and adds severe|fatal to the method names. Annotate extracted log statements with their log level #2's separate log.log(Level.X, "...") query is dropped because caching1 already covers it.
  • Python's logger.log(logging.WARNING, ...) query also accepts a concatenated_string, like the other Python query on caching1.
  • LogLevel derives Deserialize for the cache, and the cache revision goes from 25 to 26 because SourceRef has a new field.
  • Snapshots: the only content change is the added level. The integration snapshot headers were kept as they were on caching1, so their env paths don't churn.

Testing

cargo test: all 122 lib tests pass, including #2's level tests, along with the integration tests.

lnav will use this through a companion PR that points lnav-rs-ext at this branch for now.


Generated by Claude Code

ttiimm and others added 10 commits November 6, 2025 19:01
Keep the logging call name captured before the format string in each
language's query and normalize it (e.g. log::warn, logger.warning,
spdlog::info, SPDLOG_ERROR) to a LogLevel on SourceRef. The level is
serialized as an optional "level" field in the srcRef output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014JycCPeVRxuveoeMtHnJmt
Names made of words joined by underscores, like lnav's log_debug() or
SPDLOG_INFO, map to the level at the end as long as another word looks
logging related.  Arguments before the format string, as in
syslog(LOG_ERR, ...) or spdlog::log(spdlog::level::warn, ...), are also
checked for a level and take precedence over the call name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014JycCPeVRxuveoeMtHnJmt
- Only take level constants from leading arguments that are names, so a
  string literal like "conn error" no longer sets the level of a later
  string in the same call.
- Require leading arguments to be qualified by something logging
  related (LOG_ERR, logging.WARNING, spdlog::level::warn), so a variable
  like `err` no longer overrides the call name.
- Require the qualifier of a call like `x.error` to look logging
  related, so warnings.warn and parser.error don't get a level.
- Split names on case changes so logInfo and LogWarning are recognized.
- Let the Java query match severe/fatal and log.log(Level.X, ...).
- Match level-first calls in Python (logger.log(logging.WARNING, ...))
  and Rust (log!(Level::Warn, ...), tracing::event!(Level::INFO, ...)).
- Parse the level from log messages and prefer source statements with
  the same level when candidates have the same quality.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VN7ZsUqHrHHcBHoxTnSpjb
The job fails before any test runs because @vscode/test-electron can't
find the Electron binary in the current VS Code macOS download.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014JycCPeVRxuveoeMtHnJmt
Every extracted statement now has a level.  Calls where we can't tell
the level, which might not be logging at all (printf, println!, print,
or any call that takes a string), get LogLevel::Unknown, and the
"level" field is always present in the srcRef output.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014JycCPeVRxuveoeMtHnJmt
Annotate extracted log statements with their log level
Brings the LogLevel annotations from #2 over to this branch.  The
level of the message breaks ties after quality in compare_candidates(),
so it applies to both the line cache and the prefilter matches, and the
Java statements whose message is a constant get their level from the
call too.  LogLevel is now deserializable for the cache, and the cache
revision is bumped since SourceRef has a new field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KTECZJ1AReK76iN7tgD1KY
@tstack tstack self-assigned this Oct 26, 2026
@tstack
tstack merged commit 6c6ebcc into caching1 Oct 26, 2026
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.

3 participants