-
Notifications
You must be signed in to change notification settings - Fork 7
/
EmbraceEvent.kt
65 lines (51 loc) · 1.63 KB
/
EmbraceEvent.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package io.embrace.android.embracesdk
import com.google.gson.annotations.SerializedName
import io.embrace.android.embracesdk.EmbraceEvent.Type
import io.embrace.android.embracesdk.annotation.InternalApi
/**
* Wraps the event [Type]. This class is purely used for backwards-compatibility.
*/
internal class EmbraceEvent private constructor() {
/**
* This actually belongs in [Event], but to maintain backwards-compatibility of the API,
* this enum has been moved here rather than making [Event] public.
*/
@InternalApi
enum class Type(
/**
* The abbreviation used in the story ID header when sending the event to the Embrace
* API using the [ApiClient].
*
* @return the abbreviation for the event type
*/
val abbreviation: String
) {
@SerializedName("start")
START("s"),
@SerializedName("late")
LATE("l"),
@SerializedName("interrupt")
INTERRUPT("i"),
@SerializedName("crash")
CRASH("c"),
@SerializedName("end")
END("e"),
@SerializedName("info")
INFO_LOG("il"),
@SerializedName("error")
ERROR_LOG("el"),
@SerializedName("warning")
WARNING_LOG("wl"),
@SerializedName("network")
NETWORK_LOG("n");
companion object {
fun fromSeverity(severity: Severity): Type {
return when (severity) {
Severity.INFO -> INFO_LOG
Severity.WARNING -> WARNING_LOG
Severity.ERROR -> ERROR_LOG
}
}
}
}
}