Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb383238 authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Add linenumber to location property in protolog viewer config

Bug: 378822841
Test: atest protologtool-tests
Flag: EXEMPT build stage changes
Change-Id: I2d37509d6b2ad3233be1d782db94874f430a75ac
parent ff349576
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -119,7 +119,8 @@ class ProtoLogCallProcessorImpl(
                        }

                        logCallVisitor?.processCall(call, messageString, getLevelForMethodName(
                            call.name.toString(), call, context), groupMap.getValue(groupName))
                            call.name.toString(), call, context), groupMap.getValue(groupName),
                            context.lineNumber)
                    } else if (call.name.id == "init") {
                        // No processing
                    } else {
+7 −1
Original line number Diff line number Diff line
@@ -20,5 +20,11 @@ import com.android.internal.protolog.common.LogLevel
import com.github.javaparser.ast.expr.MethodCallExpr

interface ProtoLogCallVisitor {
    fun processCall(call: MethodCallExpr, messageString: String, level: LogLevel, group: LogGroup)
    fun processCall(
        call: MethodCallExpr,
        messageString: String,
        level: LogLevel,
        group: LogGroup,
        lineNumber: Int
    )
}
+5 −3
Original line number Diff line number Diff line
@@ -69,7 +69,8 @@ object ProtoLogTool {
        val messageString: String,
        val logLevel: LogLevel,
        val logGroup: LogGroup,
        val position: String
        val position: String,
        val lineNumber: Int,
    )

    private fun showHelpAndExit() {
@@ -435,9 +436,10 @@ object ProtoLogTool {
                call: MethodCallExpr,
                messageString: String,
                level: LogLevel,
                group: LogGroup
                group: LogGroup,
                lineNumber: Int,
            ) {
                val logCall = LogCall(messageString, level, group, packagePath)
                val logCall = LogCall(messageString, level, group, packagePath, lineNumber)
                calls.add(logCall)
            }
        }
+2 −1
Original line number Diff line number Diff line
@@ -91,7 +91,8 @@ class SourceTransformer(
            call: MethodCallExpr,
            messageString: String,
            level: LogLevel,
            group: LogGroup
            group: LogGroup,
            lineNumber: Int,
        ) {
            validateCall(call)
            val processedCallStatement =
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class ViewerConfigProtoBuilder : ProtoLogTool.ProtologViewerConfigBuilder {
                        .setLevel(
                            ProtoLogLevel.forNumber(log.logLevel.id))
                        .setGroupId(groupId)
                        .setLocation(log.position)
                        .setLocation("${log.position}:${log.lineNumber}")
            )
        }

Loading