buildMokokiMessage currently picks the data internally from stack traces. Instead, change the signature to provide that data in a lambda. Additionally, it can be a builder with more customization options.
As a first approach, it is only necessary to change buildHeader to find the IrCall, and extract from it the necessary data:
fileLink
fileName
className (or top-level)
methodName (or top-level, scripts?)
lineNumber
private fun buildHeader(tagToPrint: String, priority: Priority, vertical: String) =
"$tagToPrint$priority.$fileLink $vertical " +
"$fileName $vertical " +
"$className $vertical " +
"$methodName $vertical $lineNumber"
buildMokokiMessagecurrently picks the data internally from stack traces. Instead, change the signature to provide that data in a lambda. Additionally, it can be a builder with more customization options.As a first approach, it is only necessary to change
buildHeaderto find theIrCall, and extract from it the necessary data:fileLinkfileNameclassName(or top-level)methodName(or top-level, scripts?)lineNumber