Skip to content

Commit 8d8b756

Browse files
committed
Updated example app
1 parent b0b3367 commit 8d8b756

File tree

1 file changed

+27
-11
lines changed
  • samples/example-app/src/main/java/com/exceptionless/sample/app

1 file changed

+27
-11
lines changed
Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
11
package com.exceptionless.sample.app;
22

33
import com.exceptionless.exceptionlessclient.ExceptionlessClient;
4+
import com.exceptionless.exceptionlessclient.models.EventPluginContext;
45

56
public class Main {
6-
public static void main(String[] args) {
7-
ExceptionlessClient client =
8-
ExceptionlessClient.from(
9-
System.getenv("EXCEPTIONLESS_SAMPLE_APP_API_KEY"),
10-
System.getenv("EXCEPTIONLESS_SAMPLE_APP_SERVER_URL"));
11-
12-
client.getConfigurationManager().useSessions();
13-
14-
client.submitSessionStart();
7+
private static final ExceptionlessClient client =
8+
ExceptionlessClient.from(
9+
System.getenv("EXCEPTIONLESS_SAMPLE_APP_API_KEY"),
10+
System.getenv("EXCEPTIONLESS_SAMPLE_APP_SERVER_URL"));
1511

12+
public static void sampleEventSubmissions() {
1613
client.submitException(new RuntimeException("Test exception"));
17-
client.submitUnhandledException(new RuntimeException("Test exception"),"Test submission method");
14+
client.submitUnhandledException(
15+
new RuntimeException("Test exception"), "Test submission method");
1816
client.submitFeatureUsage("Test feature");
1917
client.submitLog("Test log");
2018
client.submitNotFound("Test resource");
19+
}
2120

22-
client.submitSessionEnd("Test user id");
21+
public static void sampleUseOfSessions() {
22+
client.getConfigurationManager().useSessions();
23+
client.submitEvent(
24+
EventPluginContext.from(client.createSessionStart().userIdentity("test-user").build()));
25+
client.submitSessionEnd("test-user");
26+
}
27+
28+
public static void sampleUseOfUpdatingEmailAndDescription() {
29+
client.submitEvent(
30+
EventPluginContext.from(
31+
client.createLog("test-log").referenceId("test-reference-id").build()));
32+
client.updateEmailAndDescription("test-reference-id", "[email protected]", "test-description");
33+
}
34+
35+
public static void main(String[] args) {
36+
sampleEventSubmissions();
37+
sampleUseOfUpdatingEmailAndDescription();
38+
sampleUseOfSessions();
2339
}
2440
}

0 commit comments

Comments
 (0)