mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-27 08:50:15 +08:00
Timestamp for log
This commit is contained in:
parent
b92e3ae64a
commit
2d18ab8205
@ -17,6 +17,8 @@ import net.mamoe.mirai.network.WrongPasswordException
|
|||||||
import net.mamoe.mirai.utils.LoginSolver
|
import net.mamoe.mirai.utils.LoginSolver
|
||||||
import net.mamoe.mirai.utils.SimpleLogger.LogPriority
|
import net.mamoe.mirai.utils.SimpleLogger.LogPriority
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
||||||
|
|
||||||
@ -31,6 +33,10 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
|
|
||||||
val consoleInfo = ConsoleInfo()
|
val consoleInfo = ConsoleInfo()
|
||||||
|
|
||||||
|
val sdf by lazy {
|
||||||
|
SimpleDateFormat("HH:mm:ss")
|
||||||
|
}
|
||||||
|
|
||||||
fun login(qq: String, psd: String) {
|
fun login(qq: String, psd: String) {
|
||||||
CommandManager.runCommand(ConsoleCommandSender, "/login $qq $psd")
|
CommandManager.runCommand(ConsoleCommandSender, "/login $qq $psd")
|
||||||
}
|
}
|
||||||
@ -50,13 +56,16 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Platform.runLater {
|
Platform.runLater {
|
||||||
|
|
||||||
|
val time = sdf.format(Date())
|
||||||
|
|
||||||
when (identity) {
|
when (identity) {
|
||||||
0L -> mainLog.apply {
|
0L -> mainLog.apply {
|
||||||
add("$identityStr $message")
|
add("[$time] $identityStr $message")
|
||||||
trim()
|
trim()
|
||||||
}
|
}
|
||||||
else -> cache[identity]?.logHistory?.apply {
|
else -> cache[identity]?.logHistory?.apply {
|
||||||
add("$identityStr $message")
|
add("[$time] $identityStr $message")
|
||||||
trim()
|
trim()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user