From 410d88da89c9a9e8cce20f5f9b244d23757de7d1 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Tue, 15 Sep 2015 13:57:09 -0400 Subject: [PATCH] Add a toString() to Java agent's EventRule Helps with debugging and eventually for pretty-printing. Signed-off-by: Alexandre Montplaisir Signed-off-by: Mathieu Desnoyers --- .../org/lttng/ust/agent/session/EventRule.java | 6 ++++++ .../org/lttng/ust/agent/session/LogLevelSelector.java | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/session/EventRule.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/session/EventRule.java index c25045d9..8af51a38 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/session/EventRule.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/session/EventRule.java @@ -131,4 +131,10 @@ public class EventRule { return true; } + @Override + public String toString() { + return "Event name = " + getEventName() + + ", Log level selector = (" + getLogLevelSelector().toString() + ")" + + ", Filter string = " + getFilterString(); + } } diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/session/LogLevelSelector.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/session/LogLevelSelector.java index 87d4172c..f6f6a396 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/session/LogLevelSelector.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/session/LogLevelSelector.java @@ -188,4 +188,12 @@ public class LogLevelSelector { } return true; } + + @Override + public String toString() { + if (getLogLevelType() == LogLevelType.LTTNG_EVENT_LOGLEVEL_ALL) { + return LogLevelType.LTTNG_EVENT_LOGLEVEL_ALL.toString(); + } + return String.valueOf(getLogLevel()) + ", " + getLogLevelType().toString(); + } } -- 2.34.1