4b9169460b
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@167 a672b425-5310-4d7a-af5c-997e18724b81
28 lines
643 B
Kotlin
28 lines
643 B
Kotlin
/*
|
|
* Copyright (c) 2018 Bevilacqua Joey.
|
|
*/
|
|
package ch.usi.inf.atelier.group1.util
|
|
|
|
import java.text.SimpleDateFormat
|
|
import java.util.*
|
|
|
|
object Log {
|
|
|
|
fun e(exception: Exception) {
|
|
print('E', exception.message ?: "Unknown error", true)
|
|
}
|
|
|
|
fun i(obj: Any) {
|
|
print('I', obj.toString(), false)
|
|
}
|
|
|
|
private fun print(prefix: Char, message: String, isErr: Boolean) {
|
|
val time = SimpleDateFormat("yyyy-MM-dd hh:mm").format(Date())
|
|
|
|
if (isErr) {
|
|
System.err.println("$prefix $time\t$message")
|
|
} else {
|
|
System.out.println("$prefix $time\t$message")
|
|
}
|
|
}
|
|
} |