-
Notifications
You must be signed in to change notification settings - Fork 7
/
EventType.kt
59 lines (46 loc) · 1.21 KB
/
EventType.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
package io.embrace.android.embracesdk
import android.annotation.SuppressLint
import com.squareup.moshi.Json
import io.embrace.android.embracesdk.annotation.InternalApi
/**
* Models the different types of Event.
*/
@InternalApi
@SuppressLint("EmbracePublicApiPackageRule")
internal enum class EventType(
/**
* 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
) {
@Json(name = "start")
START("s"),
@Json(name = "late")
LATE("l"),
@Json(name = "interrupt")
INTERRUPT("i"),
@Json(name = "crash")
CRASH("c"),
@Json(name = "end")
END("e"),
@Json(name = "info")
INFO_LOG("il"),
@Json(name = "error")
ERROR_LOG("el"),
@Json(name = "warning")
WARNING_LOG("wl"),
@Json(name = "network")
NETWORK_LOG("n");
companion object {
fun fromSeverity(severity: Severity): EventType {
return when (severity) {
Severity.INFO -> INFO_LOG
Severity.WARNING -> WARNING_LOG
Severity.ERROR -> ERROR_LOG
}
}
}
}