Skip to content

Commit 628254d

Browse files
committed
fix ctor for type
1 parent 2527cf7 commit 628254d

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

sentry-samples/sentry-samples-spring-boot-jakarta/src/main/java/io/sentry/samples/spring/boot/jakarta/PersonController.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
import io.sentry.ISpan;
44
import io.sentry.Sentry;
5+
import io.sentry.SentryAttribute;
6+
import io.sentry.SentryAttributes;
7+
import io.sentry.SentryLogLevel;
8+
import io.sentry.logger.SentryLogParameters;
9+
import java.awt.Point;
10+
import java.util.Collections;
511
import org.slf4j.Logger;
612
import org.slf4j.LoggerFactory;
713
import org.springframework.web.bind.annotation.GetMapping;
@@ -29,6 +35,29 @@ Person person(@PathVariable Long id) {
2935
Sentry.logger().warn("warn Sentry logging");
3036
Sentry.logger().error("error Sentry logging");
3137
Sentry.logger().info("hello %s %s", "there", "world!");
38+
Sentry.logger()
39+
.log(
40+
SentryLogLevel.ERROR,
41+
SentryLogParameters.create(
42+
null,
43+
SentryAttributes.fromMap(Collections.singletonMap("extra-attr", "attr-value"))),
44+
"hello %s %s",
45+
"there",
46+
"world!");
47+
Sentry.logger()
48+
.log(
49+
SentryLogLevel.ERROR,
50+
SentryLogParameters.create(
51+
SentryAttributes.of(
52+
SentryAttribute.booleanAttribute("boolattr", true),
53+
SentryAttribute.integerAttribute("intattr", 17),
54+
SentryAttribute.doubleAttribute("doubleattr", 0.8),
55+
SentryAttribute.stringAttribute("strattr", "strval"),
56+
SentryAttribute.named("namedAttr", new Point(10, 20)),
57+
SentryAttribute.flattened("flattenedAttr", new Point(10, 20)))),
58+
"hello %s %s",
59+
"there",
60+
"world!");
3261
LOGGER.error("Trying person with id={}", id, new RuntimeException("error while loading"));
3362
throw new IllegalArgumentException("Something went wrong [id=" + id + "]");
3463
} finally {

sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public SentryLogEventAttributeValue(final @NotNull String type, final @Nullable
2424

2525
public SentryLogEventAttributeValue(
2626
final @NotNull SentryAttributeType type, final @Nullable Object value) {
27-
this.type = type.apiName();
28-
this.value = value;
27+
this(type.apiName(), value);
2928
}
3029

3130
public @NotNull String getType() {

0 commit comments

Comments
 (0)