morhidi commented on code in PR #363:
URL:
https://github.com/apache/flink-kubernetes-operator/pull/363#discussion_r963646703
##########
flink-kubernetes-operator/src/main/java/org/apache/flink/kubernetes/operator/listener/ListenerUtils.java:
##########
@@ -134,4 +138,32 @@ private static Set<Tuple2<String, String>>
findEnabledListeners(Configuration co
}
return result;
}
+
+ public static <R extends AbstractFlinkResource<?, S>, S extends
CommonStatus<?>>
+ void logContext(FlinkResourceListener.StatusUpdateContext<R, S>
ctx) {
+ LOG.info(format(ctx.getNewStatus()));
+ }
+
+ public static <R extends AbstractFlinkResource<?, ?>> void logContext(
+ FlinkResourceListener.ResourceEventContext<R> ctx) {
+ LOG.info(format(ctx.getEvent()));
+ }
+
+ private static String format(@NonNull CommonStatus<?> status) {
+ return String.format(
+ ">>> Status | %-7s | %-15s | %s ",
+ StringUtils.isEmpty(status.getError()) ? "Info" : "Error",
+ status.getLifecycleState(),
+ StringUtils.isEmpty(status.getError())
+ ? status.getLifecycleState().getDescription()
+ : status.getError());
+ }
+
+ private static String format(@NonNull Event event) {
+ return String.format(
+ ">>> Event | %-7s | %-15s | %s",
+ event.getType().equals("Normal") ? "Info" : event.getType(),
Review Comment:
We have Info/Error/Warning there, should be fine
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]