This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push:
new 4778d131f8 Enhance CommandContext toString (#12677)
4778d131f8 is described below
commit 4778d131f857afad83eca1eb9adcba5eee123668
Author: Albumen Kevin <[email protected]>
AuthorDate: Thu Jul 6 14:29:13 2023 +0800
Enhance CommandContext toString (#12677)
* Enhance CommandContext toString
* Fix change
---
.../java/org/apache/dubbo/qos/api/CommandContext.java | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git
a/dubbo-plugin/dubbo-qos-api/src/main/java/org/apache/dubbo/qos/api/CommandContext.java
b/dubbo-plugin/dubbo-qos-api/src/main/java/org/apache/dubbo/qos/api/CommandContext.java
index 72557c38ba..3c9351d9ba 100644
---
a/dubbo-plugin/dubbo-qos-api/src/main/java/org/apache/dubbo/qos/api/CommandContext.java
+++
b/dubbo-plugin/dubbo-qos-api/src/main/java/org/apache/dubbo/qos/api/CommandContext.java
@@ -18,6 +18,10 @@ package org.apache.dubbo.qos.api;
import io.netty.channel.Channel;
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.Optional;
+
public class CommandContext {
private String commandName;
@@ -98,4 +102,17 @@ public class CommandContext {
public boolean isAllowAnonymousAccess(){
return this.qosConfiguration.isAllowAnonymousAccess();
}
+
+ @Override
+ public String toString() {
+ return "CommandContext{" +
+ "commandName='" + commandName + '\'' +
+ ", args=" + Arrays.toString(args) +
+ ", remote=" +
Optional.ofNullable(remote).map(Channel::remoteAddress).map(Objects::toString).orElse("unknown")
+
+ ", local=" +
Optional.ofNullable(remote).map(Channel::localAddress).map(Objects::toString).orElse("unknown")
+
+ ", isHttp=" + isHttp +
+ ", httpCode=" + httpCode +
+ ", qosConfiguration=" + qosConfiguration +
+ '}';
+ }
}