auto enable stacktraces with any -v

This commit is contained in:
Jonathan Shook
2021-07-13 16:12:31 -05:00
parent ce1eca5797
commit 1bf8b1bf94
2 changed files with 10 additions and 2 deletions

View File

@@ -343,6 +343,10 @@ public class NBCLI {
logger.info("console logging level is " + options.getConsoleLogLevel());
ScenariosExecutor executor = new ScenariosExecutor("executor-" + sessionName, 1);
if (options.getConsoleLogLevel().isGreaterOrEqualTo(NBLogLevel.WARN)) {
options.setWantsStackTraces(true);
logger.debug("enabling stack traces since log level is " + options.getConsoleLogLevel());
}
Scenario scenario = new Scenario(
sessionName,

View File

@@ -173,6 +173,10 @@ public class NBCLIOptions {
return reportSummaryTo;
}
public void setWantsStackTraces(boolean wantsStackTraces) {
this.showStackTraces=wantsStackTraces;
}
public enum Mode {
ParseGlobalsOnly,
ParseAllOptions
@@ -382,7 +386,7 @@ public class NBCLIOptions {
selected = path;
break;
} else {
System.err.println("ERROR: possible state dir path is not a directory: '" + path.toString() + "'");
System.err.println("ERROR: possible state dir path is not a directory: '" + path + "'");
}
}
}
@@ -397,7 +401,7 @@ public class NBCLIOptions {
PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxrwx---"))
);
} catch (IOException e) {
throw new BasicError("Could not create state directory at '" + selected.toString() + "': " + e.getMessage());
throw new BasicError("Could not create state directory at '" + selected + "': " + e.getMessage());
}
}