-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathLogMessage.kt
More file actions
38 lines (29 loc) · 1.04 KB
/
LogMessage.kt
File metadata and controls
38 lines (29 loc) · 1.04 KB
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
package com.simplecityapps.shuttle.debug
import android.annotation.SuppressLint
import java.text.SimpleDateFormat
import java.util.*
class LogMessage(val priority: Int, val tag: String?, val message: String, val throwable: Throwable?) {
val date: Date = Date()
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
other as LogMessage
if (priority != other.priority) return false
if (tag != other.tag) return false
if (message != other.message) return false
return true
}
override fun hashCode(): Int {
var result = priority
result = 31 * result + (tag?.hashCode() ?: 0)
result = 31 * result + message.hashCode()
return result
}
override fun toString(): String = "${dateFormat.format(date)}" +
"\n$priority/$tag" +
"\n$message"
companion object {
@SuppressLint("SimpleDateFormat")
val dateFormat = SimpleDateFormat("hh:mm:ss.SSS")
}
}