package gd.twohundred.jvb;

import java.io.PrintStream;
import java.util.EnumMap;
import java.util.Formatter;
import java.util.Map;

import static gd.twohundred.jvb.Logger.Level.Error;

public class StdLogger implements Logger {
    private final Map<Component, Level> levels = new EnumMap<>(Component.class);

    public StdLogger() {
        for (Component c : Component.values()) {
            levels.put(c, Level.Warning);
        }
    }

    @Override
    public void log(Component component, Level level, String format, Object... args) {
        PrintStream stream = level.ordinal() <= Error.ordinal() ? System.err : System.out;
        StringBuilder sb = new StringBuilder();
        Formatter formatter = new Formatter(sb);
        formatter.format("[%7s][%6s] ", level, component);
        formatter.format(format, args);
        sb.append(System.lineSeparator());
        stream.print(sb);
    }

    @Override
    public boolean isLevelEnabled(Component component, Level level) {
        return levels.get(component).ordinal() >= level.ordinal();
    }
}

@@ -534,24 +534,76 @@
 ... args) %7B%0A
+        if (isLevelEnabled(component, level)) %7B%0A    
         Prin
@@ -689,16 +689,20 @@
         
+  
+  
 StringBu
@@ -729,24 +729,28 @@
 gBuilder();%0A
+    
         Form
@@ -786,32 +786,36 @@
 er(sb);%0A        
+    
 formatter.format
@@ -849,32 +849,36 @@
 onent);%0A        
+ 
+   
 formatter.format
@@ -893,16 +893,20 @@
  args);%0A
+    
         
@@ -940,16 +940,20 @@
 tor());%0A
+    
         
@@ -966,24 +966,34 @@
 .print(sb);%0A
+        %7D%0A
     %7D%0A%0A    @

Fix stdout logger