| 7 | import org.jetbrains.annotations.*; |
| 8 | |
| 9 | public class Log { |
| 10 | @ApiStatus.Internal |
| 11 | public static final int _level; |
| 12 | |
| 13 | static { |
| 14 | String property = System.getProperty("skija.logLevel"); |
| 15 | if ("ALL".equals(property)) |
| 16 | _level = 0; |
| 17 | else if("TRACE".equals(property)) |
| 18 | _level = 1; |
| 19 | else if("DEBUG".equals(property)) |
| 20 | _level = 2; |
| 21 | else if("INFO".equals(property)) |
| 22 | _level = 3; |
| 23 | else if(null == property || "WARN".equals(property)) |
| 24 | _level = 4; |
| 25 | else if("ERROR".equals(property)) |
| 26 | _level = 5; |
| 27 | else if("NONE".equals(property)) |
| 28 | _level = 6; |
| 29 | else |
| 30 | throw new IllegalArgumentException("Unknown log level: " + property); |
| 31 | } |
| 32 | |
| 33 | public static void trace(String s) { |
| 34 | _log(1, "[TRACE]", s); |
| 35 | } |
| 36 | |
| 37 | public static void debug(String s) { |
| 38 | _log(2, "[DEBUG]", s); |
| 39 | } |
| 40 | |
| 41 | public static void info(String s) { |
| 42 | _log(3, "[INFO ]", s); |
| 43 | } |
| 44 | |
| 45 | public static void warn(String s) { |
| 46 | _log(4, "[WARN ]", s); |
| 47 | } |
| 48 | |
| 49 | public static void error(String s) { |
| 50 | _log(5, "[ERROR]", s); |
| 51 | } |
| 52 | |
| 53 | public static void trace(Supplier<String> s) { |
| 54 | _log(1, "[TRACE]", s); |
| 55 | } |
| 56 | |
| 57 | public static void debug(Supplier<String> s) { |
| 58 | _log(2, "[DEBUG]", s); |
| 59 | } |
| 60 | |
| 61 | public static void info(Supplier<String> s) { |
| 62 | _log(3, "[INFO ]", s); |
| 63 | } |
| 64 | |
| 65 | public static void warn(Supplier<String> s) { |
| 66 | _log(4, "[WARN ]", s); |
nothing calls this directly
no test coverage detected