[CLI-3530] Only display produce/consume info messages when the verbosity level is at least info#3208
Conversation
…en the verbosity is set to info
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull Request Overview
Adjusts producer/consumer configuration to align emitted Kafka client log messages with selected CLI verbosity.
- Maps CLI verbosity levels to explicit librdkafka log_level values (error=3, warn=4, info=6).
- Adds explicit default log_level=3 (errors only) instead of relying on librdkafka’s default (info).
- Adds clarifying comments referencing syslog-based log levels.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| case log.WARN: | ||
| return configMap.Set("log_level=4") // Warn level and above | ||
| case log.INFO: | ||
| return configMap.Set("log_level=6") // Info level and above |
There was a problem hiding this comment.
[nitpick] Duplicated warn/info log_level mapping logic in both producer and consumer functions. Extract a shared helper (e.g., mapVerbosityToLogLevel) or define named constants for 4 and 6 to reduce repetition and magic numbers.
| case log.WARN: | ||
| return configMap.Set("log_level=4") // Warn level and above | ||
| case log.INFO: | ||
| return configMap.Set("log_level=6") // Info level and above |
There was a problem hiding this comment.
[nitpick] Duplicated warn/info log_level mapping logic in both producer and consumer functions. Extract a shared helper (e.g., mapVerbosityToLogLevel) or define named constants for 4 and 6 to reduce repetition and magic numbers.
This comment has been minimized.
This comment has been minimized.
7bfedd6
Release Notes
Breaking Changes
New Features
Bug Fixes
confluent kafka topic [produce | consume]now displays log messages at the appropriate verbosity levelconfluent asyncapi export --consume-examplesnow displays consumer log messages at the appropriate verbosity levelChecklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
The confluent-kafka-go producer and consumer set the config
log_level=6by default, which corresponds to informational log messages. Since the CLI is not overwriting this, we get messages like:when starting the producer or consumer.
This PR sets
log_leveldepending on theverboseflag so that this message only appears when using at least the info level (confluent kafka topic [produce | consume] -vv).The new log settings are:
-v(warn) -->log_level=4(Warning)-vv(info) -->log_level=6(Informational)log_level=3(Error)-vvv,-vvvv, and--unsafe-traceall set thedebugconfig, which automatically enableslog_level=7, so we don't need to manually specify thelog_levelin those cases.This applies to both Cloud and On-Prem.
Blast Radius
Minimal: this change only affects the visibility of log information.
References
Test & Review
https://docs.google.com/document/d/1TcTul1nPkT4nvmMQY2ek-faSz26B75HvuXssW5ifVqE/edit?usp=sharing