|
2 | 2 |
|
3 | 3 | import io.sentry.ISpan;
|
4 | 4 | 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; |
5 | 11 | import org.slf4j.Logger;
|
6 | 12 | import org.slf4j.LoggerFactory;
|
7 | 13 | import org.springframework.web.bind.annotation.GetMapping;
|
@@ -29,6 +35,29 @@ Person person(@PathVariable Long id) {
|
29 | 35 | Sentry.logger().warn("warn Sentry logging");
|
30 | 36 | Sentry.logger().error("error Sentry logging");
|
31 | 37 | 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!"); |
32 | 61 | LOGGER.error("Trying person with id={}", id, new RuntimeException("error while loading"));
|
33 | 62 | throw new IllegalArgumentException("Something went wrong [id=" + id + "]");
|
34 | 63 | } finally {
|
|
0 commit comments