debug print colour code by the object name

This commit is contained in:
minjaesong
2024-01-08 03:19:00 +09:00
parent fb07713fa4
commit 0104d80152
2 changed files with 44 additions and 2 deletions

View File

@@ -699,7 +699,8 @@ fun printStackTrace(obj: Any, out: PrintStream = System.out) {
val hh = timeNow / 3600000 % 24
val ms = timeNow % 1000
val objName = if (obj is String) obj else obj.javaClass.simpleName
val prompt = csiG + String.format("%02d:%02d:%02d.%03d%s [%s] ", hh, mm, ss, ms, csi0, objName)
val hash = objName.hashCode().and(0x7FFFFFFF) % csis.size
val prompt = csis[hash] + String.format("%02d:%02d:%02d.%03d [%s]%s ", hh, mm, ss, ms, objName, csi0)
val indentation = " ".repeat(objName.length + 16)
Thread.currentThread().stackTrace.forEachIndexed { index, it ->
if (index == 1)