Implement kind-based logging infrastructure with hierarchies and default verbosity levels #377
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.
Overview
This PR implements the kind-based logging infrastructure requested in #374 and following up on #375. The new system allows for more semantic, flexible logging while maintaining full backwards compatibility with existing level-based logging.
Key Features
1. Default Verbosity Levels for Kinds
Added
DEFAULT_KIND_VERBOSITYdictionary that maps logging kinds to their default verbosity levels:This ensures current logging behavior remains unchanged when migrating from level-based to kind-based logging.
2. Kind Hierarchy System
Implemented a flexible hierarchy system where kinds can include other kinds:
defaultdict(lambda: True))KIND_INCLUDESfor special casesThe
check_kind_inclusion(configured_kind, log_kind)function handles all hierarchy checking with support for exact matches, prefix-based matches, and special cases.3. Kind Suffix Support
Added
kind_suffixparameter to thelog()function for building composite kinds:This replaces the pattern of passing
verbose_baseand computing relative levels, providing better semantic clarity.4. Command-Line Integration
The existing
--log-classand--disable-log-classarguments now work seamlessly with hierarchies:Usage Examples
Old Style (Still Supported)
New Style (Recommended)
The new style provides:
Implementation Details
Modified:
coq_tools/custom_arguments.pyDEFAULT_KIND_VERBOSITYdictionarymake_kind_includes()andKIND_INCLUDESfor hierarchiescheck_kind_inclusion()for hierarchy checkinglog()to supportkind_suffixparameterAdded:
docs/LOGGING.mdBackwards Compatibility
Zero breaking changes. All existing code continues to work:
levelandkindare specified, kind configuration takes precedence, then kind defaults, then explicit levelTesting
All functionality has been thoroughly validated:
Migration Path
The infrastructure is now in place for gradually migrating the codebase:
verbose_baseparameters withkind_suffixwhere appropriateThis provides a smooth, non-breaking transition path while immediately enabling more flexible and semantic logging.
Related Issues
Addresses requirements from #374:
Follows up on #375 by establishing the infrastructure for kind-based logging throughout the codebase.
Original prompt
Fixes #376
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.