use of edu.cmu.tetrad.util.DefaultTetradLoggerConfig in project tetrad by cmu-phil.
the class TetradApplicationConfig method configureLogger.
/**
* Configures the logger that the given element represents and returns its
* id.
*/
private static TetradLoggerConfig configureLogger(Element logger) {
Elements elements = logger.getChildElements();
List<TetradLoggerConfig.Event> events = new LinkedList<>();
List<String> defaultLog = new LinkedList<>();
for (int i = 0; i < elements.size(); i++) {
Element event = elements.get(i);
String eventId = event.getAttributeValue("id");
String description = event.getAttributeValue("description");
String defaultOption = event.getAttributeValue("default");
if (defaultOption != null && defaultOption.equals("on")) {
defaultLog.add(eventId);
}
events.add(new DefaultTetradLoggerConfig.DefaultEvent(eventId, description));
}
TetradLoggerConfig config = new DefaultTetradLoggerConfig(events);
// set any defaults
for (String event : defaultLog) {
config.setEventActive(event, true);
}
return config;
}
Aggregations