Kotlin: Move a function

This commit is contained in:
Ian Lynagh
2022-02-04 13:21:00 +00:00
parent 79f80e6541
commit ee9f9bb07e

View File

@@ -51,22 +51,7 @@ open class Logger(val logCounter: LogCounter, open val tw: TrapWriter) {
tw.flush()
System.out.flush()
}
fun info(msg: String) {
val fullMsg = "${timestamp()} $msg"
tw.writeComment(fullMsg)
println(fullMsg)
}
fun trace(msg: String) {
if(false) {
info(msg)
}
}
fun debug(msg: String) {
info(msg)
}
fun trace(msg: String, exn: Exception) {
trace(msg + " // " + exn)
}
fun warn(severity: Severity, msg: String, locationString: String? = null, mkLocationId: () -> Label<DbLocation> = { tw.unknownLocation }) {
val diagnosticLoc = getDiagnosticLocation()
val diagnosticLocStr = if(diagnosticLoc == null) "<unknown location>" else diagnosticLoc
@@ -90,6 +75,23 @@ open class Logger(val logCounter: LogCounter, open val tw: TrapWriter) {
val locStr = if (locationString == null) "" else "At " + locationString + ": "
print("$ts Diagnostic($diagnosticLocStr): $locStr$msg\n$suffix")
}
fun info(msg: String) {
val fullMsg = "${timestamp()} $msg"
tw.writeComment(fullMsg)
println(fullMsg)
}
fun trace(msg: String) {
if(false) {
info(msg)
}
}
fun debug(msg: String) {
info(msg)
}
fun trace(msg: String, exn: Exception) {
trace(msg + " // " + exn)
}
fun warn(msg: String, exn: Exception) {
warn(Severity.Warn, msg + " // " + exn)
}