Package jenkins.util
Class DefaultScriptListener
java.lang.Object
jenkins.util.DefaultScriptListener
- All Implemented Interfaces:
ExtensionPoint
,ScriptListener
@Extension
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class DefaultScriptListener
extends Object
implements ScriptListener
Basic default implementation of
ScriptListener
that just logs.- Since:
- 2.427
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface jenkins.util.ScriptListener
ScriptListener.ListenerOutputStream, ScriptListener.ListenerWriter
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
LOGGER
-
-
Constructor Details
-
DefaultScriptListener
public DefaultScriptListener()
-
-
Method Details
-
onScriptExecution
public void onScriptExecution(String script, groovy.lang.Binding binding, @NonNull Object feature, Object context, @NonNull String correlationId, User user) Description copied from interface:ScriptListener
Called just before scripts are executed. Examples include:- Groovy script console script execution
groovy
CLI command- Start and end of a
groovysh
CLI command session, as well as individual commands submitted - Execution of scripts integrating with Script Security Plugin
- Specified by:
onScriptExecution
in interfaceScriptListener
- Parameters:
script
- The script to be executed ornull
if no script is available yet (e.g. a shell has just been opened).binding
- The script binding, ornull
if unavailable/inapplicable.feature
- The feature that triggered this event. Usually a fixed string or even aClass
if that's unambiguously describing the feature (e.g.,Object.getClass()
).context
- Object representing the script definition context (e.g.Run
). Can benull
if not applicable (e.g., CLI commands not acting on jobs/builds).correlationId
- This value is used to correlate this script event to other, related script events. Callers are expected to provide values that allow receivers to associate script execution and output. Related events should have identical values.user
- If available, the user who executed the script. Can benull
.
-
onScriptOutput
public void onScriptOutput(String output, @NonNull Object feature, Object context, @NonNull String correlationId, User user) Description copied from interface:ScriptListener
Called when a script produces output. This can include error output.- Specified by:
onScriptOutput
in interfaceScriptListener
- Parameters:
output
- The output of the script.feature
- The feature that triggered this event. Usually a fixed string or even aClass
if that's unambiguously describing the feature (e.g.,Object.getClass()
).context
- Object representing the script definition context (e.g.Run
). Can benull
if not applicable (e.g., CLI commands not acting on jobs/builds).correlationId
- This value is used to correlate this script event to other, related script events. Callers are expected to provide values that allow receivers to associate script execution and output. Related events should have identical values.user
- If available, the user for which the output was created. Can benull
.
-