That fuck shit the fascists are using
at master 36 lines 1.0 kB view raw
1package org.tm.archive.logsubmit; 2 3import androidx.annotation.NonNull; 4 5import java.util.HashMap; 6import java.util.Map; 7 8public class LogStyleParser { 9 10 public static final String TRACE_PLACEHOLDER = "<binary trace data>"; 11 12 private static final Map<String, LogLine.Style> STYLE_MARKERS = new HashMap<String, LogLine.Style>() {{ 13 put(" V ", LogLine.Style.VERBOSE); 14 put(" D ", LogLine.Style.DEBUG); 15 put(" I ", LogLine.Style.INFO); 16 put(" W ", LogLine.Style.WARNING); 17 put(" E ", LogLine.Style.ERROR); 18 }}; 19 20 public static @NonNull LogLine.Style parseStyle(@NonNull String text) { 21 for (Map.Entry<String, LogLine.Style> entry : STYLE_MARKERS.entrySet()) { 22 if (text.contains(entry.getKey())) { 23 return entry.getValue(); 24 } 25 } 26 return LogLine.Style.NONE; 27 } 28 29 public static @NonNull LogLine.Placeholder parsePlaceholderType(@NonNull String text) { 30 if (text.equals(TRACE_PLACEHOLDER)) { 31 return LogLine.Placeholder.TRACE; 32 } else { 33 return LogLine.Placeholder.NONE; 34 } 35 } 36}