|
1 | 1 | package com.exceptionless.sample.app;
|
2 | 2 |
|
3 | 3 | import com.exceptionless.exceptionlessclient.ExceptionlessClient;
|
| 4 | +import com.exceptionless.exceptionlessclient.models.EventPluginContext; |
4 | 5 |
|
5 | 6 | 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")); |
15 | 11 |
|
| 12 | + public static void sampleEventSubmissions() { |
16 | 13 | 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"); |
18 | 16 | client.submitFeatureUsage("Test feature");
|
19 | 17 | client.submitLog("Test log");
|
20 | 18 | client.submitNotFound("Test resource");
|
| 19 | + } |
21 | 20 |
|
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(); |
23 | 39 | }
|
24 | 40 | }
|
0 commit comments