package org.spoofax.jsglr2;

import org.metaborg.parsetable.IParseTable;
import org.spoofax.interpreter.terms.IStrategoTerm;
import org.spoofax.jsglr2.parser.observing.LogParserObserver;

public class JSGLR2Spec {

    public final JSGLR2Variant.Preset variant;
    public final JSGLR2Logging logging;

    public JSGLR2Spec(JSGLR2Variant.Preset variant, JSGLR2Logging logging) {
        this.variant = variant;
        this.logging = logging;
    }

    public JSGLR2<IStrategoTerm> getJSGLR2(IParseTable parseTable) {
        JSGLR2<IStrategoTerm> jsglr2 = variant.getJSGLR2(parseTable);

        if(logging != JSGLR2Logging.None)
            jsglr2.attachObserver(new LogParserObserver(logging));

        return jsglr2;
    }

}

@@ -22,16 +22,53 @@
 sglr2;%0A%0A
+import java.util.function.Consumer;%0A%0A
 import o
@@ -103,16 +103,96 @@
 eTable;%0A
+import org.metaborg.util.log.ILogger;%0Aimport org.metaborg.util.log.LoggerUtils;%0A
 import o
@@ -325,16 +325,166 @@
 Spec %7B%0A%0A
+    private static final ILogger logger = LoggerUtils.logger(JSGLR2.class);%0A    private static final Consumer%3CString%3E loggerConsumer = logger::info;%0A%0A
     publ
@@ -949,16 +949,32 @@
 bserver(
+loggerConsumer, 
 logging)

Use logger instead of stdout for JSGLR2 logging