use of org.graylog2.rest.models.system.loggers.responses.SingleSubsystemSummary in project graylog2-server by Graylog2.
the class LoggersResource method subsystems.
@GET
@Timed
@Path("/subsystems")
@ApiOperation(value = "List all logger subsystems and their current levels")
@Produces(MediaType.APPLICATION_JSON)
public SubsystemSummary subsystems() {
final Map<String, SingleSubsystemSummary> subsystems = Maps.newHashMap();
for (Map.Entry<String, Subsystem> subsystem : SUBSYSTEMS.entrySet()) {
if (!isPermitted(RestPermissions.LOGGERS_READSUBSYSTEM, subsystem.getKey())) {
continue;
}
try {
final String category = subsystem.getValue().getCategory();
final Level level = getLoggerLevel(category);
subsystems.put(subsystem.getKey(), SingleSubsystemSummary.create(subsystem.getValue().getTitle(), subsystem.getValue().getCategory(), subsystem.getValue().getDescription(), level.toString().toLowerCase(Locale.ENGLISH), level.intLevel()));
} catch (Exception e) {
LOG.error("Error while listing logger subsystem.", e);
}
}
return SubsystemSummary.create(subsystems);
}
Aggregations