Repository navigation
Bring the log level annotations from main into caching1 - #3
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Tim · project thread
#2 (log levels on statements) was merged into
main, but lnav builds againstcaching1, which has diverged a lot. This mergesmainintocaching1and 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, andlink_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. TheLogRef::compare_candidates()method from Annotate extracted log statements with their log level #2 is dropped.MessageRef) carry the call's level too, soSourceRef::from_message_ref()sets it.QueryResult::level()so both paths share it.log(Level, String)and message-ref patterns and addssevere|fatalto the method names. Annotate extracted log statements with their log level #2's separatelog.log(Level.X, "...")query is dropped because caching1 already covers it.logger.log(logging.WARNING, ...)query also accepts aconcatenated_string, like the other Python query on caching1.LogLevelderivesDeserializefor the cache, and the cache revision goes from 25 to 26 becauseSourceRefhas a new field.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-extat this branch for now.Generated by Claude Code