valdar commented on a change in pull request #193: URL: https://github.com/apache/camel-kafka-connector/pull/193#discussion_r428154795
########## File path: core/src/main/java/org/apache/camel/kafkaconnector/utils/TaskHelper.java ########## @@ -93,4 +101,40 @@ private static Boolean stringStartWithOneOfPrefixes(String s, Set<String> prefix } return false; } + + public static <CFG extends AbstractConfig> void logRecordContent(Logger logger, ConnectRecord<?> record, CFG config) { + if (logger != null && record != null && config != null) { + // do not log record's content by default, as it may contain sensitive information + LoggingLevel level = LoggingLevel.OFF; + try { + final String key = (record instanceof SourceRecord) + ? CamelSourceConnectorConfig.CAMEL_SOURCE_CONTENT_LOG_LEVEL_CONF + : CamelSinkConnectorConfig.CAMEL_SINK_CONTENT_LOG_LEVEL_CONF; + level = LoggingLevel.valueOf(config.getString(key).trim().toUpperCase()); + } catch (Throwable e) { + } + if (level != LoggingLevel.OFF && Arrays.asList(LoggingLevel.values()).contains(level)) { Review comment: is this `Arrays.asList(LoggingLevel.values()).contains(level)` check needed? or you can just log a warning in the default clasue of the switch case? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org