Class LogElements<T>
- Type Parameters:
T- the element type of the inputPCollection
- All Implemented Interfaces:
Serializable,HasDisplayData
PTransform for logging elements of a PCollection.
Each element is logged and then emitted unchanged.
PCollection<String> words = ...;
PCollection<String> loggedWords = words.apply(LogElements.info().withPrefix("word: "));
- See Also:
-
Field Summary
Fields inherited from class org.apache.beam.sdk.transforms.PTransform
annotations, displayData, name, resourceHints -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> LogElements<T> debug()Returns aLogElementstransform that logs elements atLevel.DEBUG.static <T> LogElements<T> error()Returns aLogElementstransform that logs elements atLevel.ERROR.expand(PCollection<T> input) Override this method to specify how thisPTransformshould be expanded on the givenInputT.static <T> LogElements<T> info()Returns aLogElementstransform that logs elements atLevel.INFO.static <T> LogElements<T> Returns aLogElementstransform that logs elements at the given level.voidpopulateDisplayData(DisplayData.Builder builder) Register display data for the given transform or component.static <T> LogElements<T> trace()Returns aLogElementstransform that logs elements atLevel.TRACE.static <T> LogElements<T> warn()Returns aLogElementstransform that logs elements atLevel.WARN.Returns a newLogElementstransform that logs each element's pane info.withPrefix(String prefix) Returns a newLogElementstransform with the given prefix before each element.Returns a newLogElementstransform that logs each element's timestamp.Returns a newLogElementstransform that logs each element's window.Methods inherited from class org.apache.beam.sdk.transforms.PTransform
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, setDisplayData, setResourceHints, toString, validate, validate
-
Method Details
-
trace
Returns aLogElementstransform that logs elements atLevel.TRACE. -
debug
Returns aLogElementstransform that logs elements atLevel.DEBUG. -
info
Returns aLogElementstransform that logs elements atLevel.INFO. -
warn
Returns aLogElementstransform that logs elements atLevel.WARN. -
error
Returns aLogElementstransform that logs elements atLevel.ERROR. -
of
Returns aLogElementstransform that logs elements at the given level. -
withPrefix
Returns a newLogElementstransform with the given prefix before each element. -
withTimestamp
Returns a newLogElementstransform that logs each element's timestamp. -
withWindow
Returns a newLogElementstransform that logs each element's window. -
withPaneInfo
Returns a newLogElementstransform that logs each element's pane info. -
expand
Description copied from class:PTransformOverride this method to specify how thisPTransformshould be expanded on the givenInputT.NOTE: This method should not be called directly. Instead apply the
PTransformshould be applied to theInputTusing theapplymethod.Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
- Specified by:
expandin classPTransform<PCollection<T>,PCollection<T>>
-
populateDisplayData
Description copied from class:PTransformRegister display data for the given transform or component.populateDisplayData(DisplayData.Builder)is invoked by Pipeline runners to collect display data viaDisplayData.from(HasDisplayData). Implementations may callsuper.populateDisplayData(builder)in order to register display data in the current namespace, but should otherwise usesubcomponent.populateDisplayData(builder)to use the namespace of the subcomponent.By default, does not register any display data. Implementors may override this method to provide their own display data.
- Specified by:
populateDisplayDatain interfaceHasDisplayData- Overrides:
populateDisplayDatain classPTransform<PCollection<T>,PCollection<T>> - Parameters:
builder- The builder to populate with display data.- See Also:
-