rpc: implement set_log_level and set_log_categories handlers
#573
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.
What
Implements the
set_log_levelandset_log_categoriesRPC endpoints that were previously marked withtodo!(). These handlers allow dynamic adjustment of logging levels and categories via RPC, matching monerod's behavior.Why
These endpoints are part of the standard Monero RPC API and enable dynamic log level adjustment without restarting the daemon, ensuring compatibility with existing Monero tooling.
Where
binaries/cuprated/src/rpc/handlers/other_json.rsset_log_levelhandlerset_log_categorieshandlernot_available()How
set_log_level: Maps Monero log level numbers (0-4) to Rust'stracing::LevelFilter(ERROR, WARN, INFO, DEBUG, TRACE) following the monerod implementation. Updates both stdout and file logging filters.set_log_categories: Parses category strings in EnvFilter format (e.g.,"*:INFO","net:DEBUG") following the monerod implementation. Extracts the log level and applies it to both logging outputs, defaulting to INFO if parsing fails.Both handlers follow existing code patterns and error handling conventions.