Package io.sentry.util
Class LoggerPropertiesUtil
java.lang.Object
io.sentry.util.LoggerPropertiesUtil
Utility class for applying logger properties (e.g. MDC) to Sentry events and log attributes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyPropertiesToAttributes(@NotNull SentryAttributes attributes, @NotNull List<String> targetKeys, @NotNull Map<String, String> properties) Applies logger properties from a properties map to SentryAttributes for logs.static voidapplyPropertiesToEvent(@NotNull SentryEvent event, @NotNull List<String> targetKeys, @NotNull Map<String, String> properties) static voidapplyPropertiesToEvent(@NotNull SentryEvent event, @NotNull List<String> targetKeys, @NotNull Map<String, String> properties, @NotNull String contextName) Applies logger properties from a map to a Sentry event as tags and context.
-
Constructor Details
-
LoggerPropertiesUtil
public LoggerPropertiesUtil()
-
-
Method Details
-
applyPropertiesToEvent
@Internal public static void applyPropertiesToEvent(@NotNull @NotNull SentryEvent event, @NotNull @NotNull List<String> targetKeys, @NotNull @NotNull Map<String, String> properties, @NotNull @NotNull String contextName) Applies logger properties from a map to a Sentry event as tags and context. The properties that have keys matching any of the `targetKeys` will be applied as tags, while the others will be reported in an ad-hoc context.- Parameters:
event- the Sentry event to add tags totargetKeys- the list of property keys to apply as tagsproperties- the properties map (e.g. MDC) - this map will be modified by removing properties which were applied as tagscontextName- the name of the context to use for leftover properties
-
applyPropertiesToEvent
-
applyPropertiesToAttributes
@Internal public static void applyPropertiesToAttributes(@NotNull @NotNull SentryAttributes attributes, @NotNull @NotNull List<String> targetKeys, @NotNull @NotNull Map<String, String> properties) Applies logger properties from a properties map to SentryAttributes for logs. Only the properties with keys that are found in `targetKeys` will be applied as attributes. Properties with null values are filtered out.- Parameters:
attributes- the SentryAttributes to add the properties totargetKeys- the list of property keys to apply as attributesproperties- the properties map (e.g. MDC)
-