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

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

Add id to LogLevel matching those in the proto objects

Bug: 364254249
Test: atest InternalTests:com.android.internal.protolog.PerfettoProtoLogImplTest
Flag: EXEMPT minor refactor
Change-Id: Ia73d164bce934390187ab9011907cd1f96672166
parent 72f5a375
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -688,7 +688,7 @@ public class PerfettoProtoLogImpl extends IProtoLogClient.Stub implements IProto

            os.write(MessageData.MESSAGE_ID, messageHash);
            os.write(MESSAGE, message);
            os.write(LEVEL, level.ordinal());
            os.write(LEVEL, level.id);
            os.write(GROUP_ID, logGroup.getId());

            os.end(messageConfigToken);
+10 −2
Original line number Diff line number Diff line
@@ -17,10 +17,18 @@
package com.android.internal.protolog.common;

public enum LogLevel {
    DEBUG("d"), VERBOSE("v"), INFO("i"), WARN("w"), ERROR("e"), WTF("wtf");
    DEBUG("d", 1),
    VERBOSE("v", 2),
    INFO("i", 3),
    WARN("w", 4),
    ERROR("e", 5),
    WTF("wtf", 6);

    public final String shortCode;
    LogLevel(String shortCode) {
    public final int id;

    LogLevel(String shortCode, int id) {
        this.shortCode = shortCode;
        this.id = id;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ class ViewerConfigProtoBuilder : ProtoLogTool.ProtologViewerConfigBuilder {
                        .setMessageId(key)
                        .setMessage(log.messageString)
                        .setLevel(
                            ProtoLogLevel.forNumber(log.logLevel.ordinal + 1))
                            ProtoLogLevel.forNumber(log.logLevel.id))
                        .setGroupId(groupId)
                        .setLocation(log.position)
            )