Class KubeVirtLog
[KubeVirt …] messages to
agent console logs.
System-level logs (via java.util.logging) already carry timestamps,
but agent console output written through TaskListener does not. This
utility adds a UTC timestamp to every line so that operators can correlate
agent activity with system events and measure provisioning durations.
The format mirrors the Jenkins SSH launcher convention so that all agent log entries share a consistent layout:
[03/05/26 12:20:07] [KubeVirt] VM provisioning complete, launching SSH connection...
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiderror(TaskListener listener, String message) Prints a timestamped[KubeVirt] ERROR: …line to the agent log.static voidlog(PrintStream out, String message) Prints a timestamped[KubeVirt …]line to the agent log.static StringReturns a non-null, human-readable description of a throwable.
-
Method Details
-
log
Prints a timestamped[KubeVirt …]line to the agent log.- Parameters:
out- the agent consolePrintStreammessage- the message to print (without prefix)
-
error
Prints a timestamped[KubeVirt] ERROR: …line to the agent log.We intentionally write through
PrintStream.println()rather thanTaskListener.error(String, Object...)because the latter is aFormatter-based API. Any%character that appears in an exception message (e.g."CPU at 100% load") would be misinterpreted as a format specifier and throwMissingFormatArgumentExceptionat runtime.- Parameters:
listener- the task listenermessage- the error message (without prefix)
-
messageOf
Returns a non-null, human-readable description of a throwable.If the exception carries a message, that message is returned. Otherwise the simple class name is used (e.g.
"NullPointerException") so that log lines never contain a bare"null"string.- Parameters:
t- the throwable- Returns:
- a description suitable for log messages
-