Commit 2cf29fd6 by Johannes Edmeier

Use logger levels from /loggers

Since the logging backands may have different possible levels, we use the list provided by the /logging endpoint
parent fe84e3ac
{{ $ctrl.logger.name }}
<div class="btn-group pull-right">
<label class="btn btn-small" ng-class="$ctrl.getLoggerClass('TRACE')" ng-click="$ctrl.setLevel('TRACE')">TRACE</label>
<label class="btn btn-small" ng-class="$ctrl.getLoggerClass('DEBUG')" ng-click="$ctrl.setLevel('DEBUG')">DEBUG</label>
<label class="btn btn-small" ng-class="$ctrl.getLoggerClass('INFO')" ng-click="$ctrl.setLevel('INFO')">INFO</label>
<label class="btn btn-small" ng-class="$ctrl.getLoggerClass('WARN')" ng-click="$ctrl.setLevel('WARN')">WARN</label>
<label class="btn btn-small" ng-class="$ctrl.getLoggerClass('ERROR')" ng-click="$ctrl.setLevel('ERROR')">ERROR</label>
<label class="btn btn-small" ng-class="$ctrl.getLoggerClass('OFF')" ng-click="$ctrl.setLevel('OFF')">OFF</label>
</div>
<button ng-repeat="level in $ctrl.logger.levels" class="btn btn-small" ng-class="$ctrl.getLoggerClass(level)" ng-click="$ctrl.setLevel(level)"
ng-bind="level"></button>
</div>
\ No newline at end of file
......@@ -34,9 +34,10 @@ module.exports = function ($scope, application, ApplicationLogging) {
$scope.showPackageLoggers = !$scope.showPackageLoggers;
};
var Logger = function (name, data) {
var Logger = function (name, data, levels) {
this.name = name;
this.level = data.configuredLevel || data.effectiveLevel;
this.levels = levels;
var i = name.lastIndexOf('.') + 1;
this.packageLogger = name.charAt(i) !== name.charAt(i).toUpperCase();
......@@ -49,8 +50,9 @@ module.exports = function ($scope, application, ApplicationLogging) {
return application.getLoggers().then(function (response) {
$scope.error = null;
var loggers = [];
angular.forEach(response.data, function (value, key) {
loggers.push(new Logger(key, value));
var levels = response.data.levels.reverse();
angular.forEach(response.data.loggers, function (value, key) {
loggers.push(new Logger(key, value, levels));
});
$scope.loggers = loggers;
}).catch(function (response) {
......
......@@ -58,6 +58,7 @@ module.exports = function ($q, jolokia) {
var Logger = function (name) {
this.name = name;
this.level = null;
this.levels = ['TRACE', 'DEBUG', 'WARN', 'INFO', 'ERROR', 'OFF']; //Logback Default
var i = name.lastIndexOf('.') + 1;
this.packageLogger = name.charAt(i) !== name.charAt(i).toUpperCase();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment