You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "cmccabe (via GitHub)" <gi...@apache.org> on 2023/05/08 21:05:27 UTC

[GitHub] [kafka] cmccabe commented on a diff in pull request #13686: MINOR: Create the MetadataNode classes to introspect MetadataImage

cmccabe commented on code in PR #13686:
URL: https://github.com/apache/kafka/pull/13686#discussion_r1187897908


##########
shell/src/main/java/org/apache/kafka/shell/node/printer/ShellNodePrinter.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.shell.node.printer;
+
+import org.apache.kafka.image.node.printer.MetadataNodePrinter;
+import org.apache.kafka.image.node.printer.MetadataNodeRedactionCriteria;
+
+import java.io.PrintWriter;
+
+
+/**
+ * The Kafka metadata shell.
+ */
+public class ShellNodePrinter implements MetadataNodePrinter {
+    private final PrintWriter writer;
+    private int indentationLevel;
+
+    public ShellNodePrinter(PrintWriter writer) {
+        this.writer = writer;
+    }
+
+    String indentationString() {
+        StringBuilder bld = new StringBuilder();
+        for (int i = 0; i < indentationLevel; i++) {
+            for (int j = 0; j < 2; j++) {
+                bld.append(" ");
+            }
+        }
+        return bld.toString();
+    }
+
+    @Override
+    public MetadataNodeRedactionCriteria redactionCriteria() {
+        return MetadataNodeRedactionCriteria.Disabled.INSTANCE;

Review Comment:
   yes, I think that makes sense for the shell since it is targetted at operators after all.
   
   the main concern in other cases is the controller / broker daemon sending stuff to log4j that shouldn't be there. very different than the shell use 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.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org