Search in sources :

Example 1 with Level

use of org.metaborg.util.log.Level in project nabl by metaborg.

the class StatixPrimitive method getDebugContext.

protected IDebugContext getDebugContext(ITerm levelTerm) throws InterpreterException {
    final String levelString = M.stringValue().match(levelTerm).orElseThrow(() -> new InterpreterException("Expected log level."));
    @Nullable final Level level = levelString.equalsIgnoreCase("None") ? null : Level.parse(levelString);
    final IDebugContext debug = level != null ? new LoggerDebugContext(getLogger(), level) : new NullDebugContext();
    return debug;
}
Also used : IDebugContext(mb.statix.solver.log.IDebugContext) LoggerDebugContext(mb.statix.solver.log.LoggerDebugContext) InterpreterException(org.spoofax.interpreter.core.InterpreterException) Level(org.metaborg.util.log.Level) NullDebugContext(mb.statix.solver.log.NullDebugContext) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 IDebugContext (mb.statix.solver.log.IDebugContext)1 LoggerDebugContext (mb.statix.solver.log.LoggerDebugContext)1 NullDebugContext (mb.statix.solver.log.NullDebugContext)1 Level (org.metaborg.util.log.Level)1 InterpreterException (org.spoofax.interpreter.core.InterpreterException)1