@SuppressWarnings("deprecation")
    private static LogProtocol.LogMessage.Level toLogMessageLevel(Level level) {
        Level vespaLevel = LogLevel.getVespaLogLevel(level);
        if (vespaLevel.equals(LogLevel.FATAL)) {
            return LogProtocol.LogMessage.Level.FATAL;
        } else if (vespaLevel.equals(LogLevel.ERROR)) {
            return LogProtocol.LogMessage.Level.ERROR;
        } else if (vespaLevel.equals(LogLevel.WARNING)) {
            return LogProtocol.LogMessage.Level.WARNING;
        } else if (vespaLevel.equals(LogLevel.CONFIG)) {
            return LogProtocol.LogMessage.Level.CONFIG;
        } else if (vespaLevel.equals(LogLevel.INFO)) {
            return LogProtocol.LogMessage.Level.INFO;
        } else if (vespaLevel.equals(LogLevel.EVENT)) {
            return LogProtocol.LogMessage.Level.EVENT;
        } else if (vespaLevel.equals(LogLevel.DEBUG)) {
            return LogProtocol.LogMessage.Level.DEBUG;
        } else if (vespaLevel.equals(LogLevel.SPAM)) {
            return LogProtocol.LogMessage.Level.SPAM;
        } else {
            return LogProtocol.LogMessage.Level.UNKNOWN;
        }
    }
Utility class for serialization of log requests and responses.

@author bjorncs
logserver/src/main/java/ai/vespa/logserver/protocol/ProtobufSerialization.java