LogLevel from NeuralDecoder is now correctly passed to native python process
@@ -22,6 +22,7 @@ import org.apache.logging.log4j.Logger;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
@@ -80,6 +81,12 @@ class NativeProcess implements Closeable {
command.add("main_loop.py");
command.add(model.getAbsolutePath());
+ String logLevel = LogThread.getNativeLogLevel();
+ if (logLevel != null) {
+ command.add("--log-level");
+ command.add(logLevel);
+ }
+
if (gpu >= 0) {
command.add("--gpu");
command.add(Integer.toString(gpu));
@@ -337,6 +344,17 @@ class NativeProcess implements Closeable {
LOG_LEVELS.put("DEBUG", Level.DEBUG);
}
+ public static String getNativeLogLevel() {
+ Level level = logger.getLevel();
+
+ for (Map.Entry<String, Level> entry : LOG_LEVELS.entrySet()) {
+ if (level.equals(entry.getValue()))
+ return entry.getKey();
+ }
+
+ return null;
+ }
+
private final BufferedReader reader;
private LogThread(InputStream stream) {
