Skip to content

add optional verbose logging#278

Merged
ca333 merged 1 commit intodevfrom
optional_logging
Nov 1, 2025
Merged

add optional verbose logging#278
ca333 merged 1 commit intodevfrom
optional_logging

Conversation

@ca333
Copy link
Copy Markdown
Contributor

@ca333 ca333 commented Nov 1, 2025

Summary by CodeRabbit

  • New Features

    • Logging configuration is now publicly accessible, allowing control of verbose output across activation workflows.
  • Chores

    • Debug logs in activation processes are now conditional, emitting only when verbose mode is enabled.

Copilot AI review requested due to automatic review settings November 1, 2025 20:38
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 1, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The PR exports KdfLoggingConfig from komodo_defi_framework and updates eight activation strategy files in komodo_defi_sdk to conditionally emit debug logs based on a verbose logging flag, reducing noise during normal operation.

Changes

Cohort / File(s) Summary
Framework Configuration Export
packages/komodo_defi_framework/lib/komodo_defi_framework.dart
Added public export for kdf_logging_config.dart to extend the public API surface.
Activation Strategies with Conditional Logging
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/bch_activation_strategy.dart, custom_erc20_activation_strategy.dart, erc20_activation_strategy.dart, eth_task_activation_strategy.dart, eth_with_tokens_activation_strategy.dart, qtum_activation_strategy.dart, tendermint_activation_strategy.dart, utxo_activation_strategy.dart, zhtlc_activation_strategy.dart
Added import for komodo_defi_framework and wrapped debug log calls with if (KdfLoggingConfig.verboseLogging) guards to conditionally emit logs. No changes to activation logic or public interfaces.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

The changes follow a consistent, repetitive pattern across all strategy files: importing the framework package and wrapping existing debug logs with a verbose flag check. While nine files are affected, the homogeneous nature of the edits reduces cognitive load per file. Reviewers should verify that:

  • The import statement is correctly added in each file
  • All debug log statements (not error/warning logs) are appropriately guarded
  • No functional logic inadvertently changed during wrapping

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • CharlVS

Poem

🐰 The logs now whisper, not shout with glee,
When verbose is off, the SDK stays quiet and free,
Configuration flags keep the noise at bay,
Activation flows cleaner, come what may! ✨

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch optional_logging

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb7881c and dbf0075.

📒 Files selected for processing (10)
  • packages/komodo_defi_framework/lib/komodo_defi_framework.dart (1 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/bch_activation_strategy.dart (4 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/custom_erc20_activation_strategy.dart (3 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/erc20_activation_strategy.dart (2 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/eth_task_activation_strategy.dart (2 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/eth_with_tokens_activation_strategy.dart (2 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/qtum_activation_strategy.dart (3 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/tendermint_activation_strategy.dart (3 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/utxo_activation_strategy.dart (2 hunks)
  • packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/zhtlc_activation_strategy.dart (2 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ca333 ca333 changed the base branch from main to dev November 1, 2025 20:38
@ca333 ca333 merged commit 0cdff3c into dev Nov 1, 2025
6 of 8 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR conditionalizes verbose debug logging throughout the activation strategy files by wrapping log() calls with checks against KdfLoggingConfig.verboseLogging. This allows developers to reduce log noise by disabling verbose RPC logging when not needed.

Key changes:

  • Added KdfLoggingConfig export to the komodo_defi_framework package
  • Wrapped all debug log statements in activation strategies with if (KdfLoggingConfig.verboseLogging) checks
  • Updated 9 activation strategy files to conditionally log RPC activation details

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/komodo_defi_framework/lib/komodo_defi_framework.dart Exports KdfLoggingConfig for use in SDK packages
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/zhtlc_activation_strategy.dart Wraps ZHTLC activation debug logs with verbose logging checks
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/utxo_activation_strategy.dart Wraps UTXO/Electrum activation debug logs with verbose logging checks
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/tendermint_activation_strategy.dart Wraps Tendermint activation debug logs with verbose logging checks
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/qtum_activation_strategy.dart Wraps QTUM activation debug logs with verbose logging checks
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/eth_with_tokens_activation_strategy.dart Wraps ETH platform activation debug logs with verbose logging checks
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/eth_task_activation_strategy.dart Wraps ETH task-based activation debug logs with verbose logging checks
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/erc20_activation_strategy.dart Wraps ERC20 token activation debug logs with verbose logging checks
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/custom_erc20_activation_strategy.dart Wraps custom ERC20 token activation debug logs with verbose logging checks
packages/komodo_defi_sdk/lib/src/activation/protocol_strategies/bch_activation_strategy.dart Wraps BCH and SLP token activation debug logs with verbose logging checks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +107 to +118
if (KdfLoggingConfig.verboseLogging) {
log(
'[RPC] Activating ZHTLC coin: ${asset.id.id}',
name: 'ZhtlcActivationStrategy',
);
log(
}
if (KdfLoggingConfig.verboseLogging) {
log(
'[RPC] Activation parameters: ${jsonEncode({'ticker': asset.id.id, 'protocol': asset.protocol.subClass.formatted, 'activation_params': params.toRpcParams(), 'zcash_params_path': userConfig.zcashParamsPath, 'scan_blocks_per_iteration': userConfig.scanBlocksPerIteration, 'scan_interval_ms': userConfig.scanIntervalMs, 'polling_interval_ms': effectivePollingInterval.inMilliseconds, 'priv_key_policy': privKeyPolicy.toJson()})}',
name: 'ZhtlcActivationStrategy',
);
}
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two consecutive log statements are wrapped in separate if (KdfLoggingConfig.verboseLogging) blocks. Combine them into a single conditional block to avoid redundant condition checks.

Copilot uses AI. Check for mistakes.
Comment on lines +110 to +117
if (KdfLoggingConfig.verboseLogging) {
log(
'[RPC] Activating Tendermint platform: ${asset.id.id}',
name: 'TendermintWithTokensActivationStrategy',
);
log(
}
if (KdfLoggingConfig.verboseLogging) {
log(
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two consecutive log statements are wrapped in separate if (KdfLoggingConfig.verboseLogging) blocks. Combine them into a single conditional block to avoid redundant condition checks.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +56
if (KdfLoggingConfig.verboseLogging) {
log(
'[RPC] Activating QTUM coin: ${asset.id.id}',
name: 'QtumActivationStrategy',
);
log(
}
if (KdfLoggingConfig.verboseLogging) {
log(
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two consecutive log statements are wrapped in separate if (KdfLoggingConfig.verboseLogging) blocks. Combine them into a single conditional block to avoid redundant condition checks.

Copilot uses AI. Check for mistakes.
Comment on lines +123 to +124
}
if (KdfLoggingConfig.verboseLogging) {
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two consecutive log statements are wrapped in separate if (KdfLoggingConfig.verboseLogging) blocks. Combine them into a single conditional block to avoid redundant condition checks.

Suggested change
}
if (KdfLoggingConfig.verboseLogging) {

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 1, 2025

Visit the preview URL for this PR (updated for commit dbf0075):

https://komodo-playground--pr278-optional-logging-85f1ddcg.web.app

(expires Sat, 08 Nov 2025 20:42:52 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2bfedd77fdea45b25ba7c784416e81f177aa5c47

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 1, 2025

Visit the preview URL for this PR (updated for commit dbf0075):

https://kdf-sdk--pr278-optional-logging-uj69eled.web.app

(expires Sat, 08 Nov 2025 20:42:52 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 9c1b6e6c010cf0b965c455ba7a69c4aedafa8a1d

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