Skip to content
Snippets Groups Projects
Commit 3d453930 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

Better FATAL level rendering

parent f3b8aa0d
Branches
Tags v2.11.5
No related merge requests found
...@@ -63,15 +63,16 @@ public enum Level { ...@@ -63,15 +63,16 @@ public enum Level {
Level result = null; Level result = null;
if (value != null) { if (value != null) {
String trimmed = value.trim(); String trimmed = value.trim();
// In slf4j, "warning" level is named "WARN"
if (WARN.equalsIgnoreCase(trimmed)) {
result = Level.WARNING;
} else {
for (Level lvl : values()) { for (Level lvl : values()) {
if (trimmed.equalsIgnoreCase(lvl.toString())) { if (trimmed.equalsIgnoreCase(lvl.getUpperCaseName())) {
result = lvl; result = lvl;
break; break;
} }
} }
// In slf4j, "warning" level is named "WARN"
if ((result == null) && WARN.equalsIgnoreCase(value)) {
result = Level.WARNING;
} }
} }
return result; return result;
......
...@@ -394,8 +394,8 @@ public abstract class ALogViewer<L extends JComponent & ILogManager & ILevelRend ...@@ -394,8 +394,8 @@ public abstract class ALogViewer<L extends JComponent & ILogManager & ILevelRend
// level filter // level filter
levelLabel = generateTitleLabel("fr.soleil.lib.project.swing.log.filter.level"); levelLabel = generateTitleLabel("fr.soleil.lib.project.swing.log.filter.level");
levelComboBox = generateDynamicComboBox(Level.FATAL, Level.ERROR, Level.WARNING, Level.INFO, Level.DEBUG, levelComboBox = generateDynamicComboBox(Level.INFO, Level.FATAL, Level.ERROR, Level.WARNING, Level.INFO,
Level.ALL); Level.DEBUG, Level.ALL);
levelComboBox.setRenderer(new LevelListCellRenderer(levelComboBox)); levelComboBox.setRenderer(new LevelListCellRenderer(levelComboBox));
levelCheckBox = generateCheckBox("fr.soleil.lib.project.swing.log.filter.level.minimum", true); levelCheckBox = generateCheckBox("fr.soleil.lib.project.swing.log.filter.level.minimum", true);
levelPanel = generatePanel(levelLabel, levelComboBox, levelCheckBox); levelPanel = generatePanel(levelLabel, levelComboBox, levelCheckBox);
......
...@@ -35,8 +35,9 @@ import fr.soleil.lib.project.swing.SwingUtilitiesConstants; ...@@ -35,8 +35,9 @@ import fr.soleil.lib.project.swing.SwingUtilitiesConstants;
public class LevelListCellRenderer extends LightSelectionBackgroundListCellRenderer public class LevelListCellRenderer extends LightSelectionBackgroundListCellRenderer
implements ILevelRenderer, SwingUtilitiesConstants { implements ILevelRenderer, SwingUtilitiesConstants {
private static final long serialVersionUID = 2548432262986415834L; private static final long serialVersionUID = -3936760965048303415L;
protected static final ImageIcon FATAL_ICON = DEFAULT_ICONS.getIcon("fr.soleil.lib.project.swing.log.fatal");
protected static final ImageIcon ERROR_ICON = DEFAULT_ICONS.getIcon("fr.soleil.lib.project.swing.log.error"); protected static final ImageIcon ERROR_ICON = DEFAULT_ICONS.getIcon("fr.soleil.lib.project.swing.log.error");
protected static final ImageIcon WARNING_ICON = DEFAULT_ICONS.getIcon("fr.soleil.lib.project.swing.log.warning"); protected static final ImageIcon WARNING_ICON = DEFAULT_ICONS.getIcon("fr.soleil.lib.project.swing.log.warning");
protected static final ImageIcon INFO_ICON = DEFAULT_ICONS.getIcon("fr.soleil.lib.project.swing.log.info"); protected static final ImageIcon INFO_ICON = DEFAULT_ICONS.getIcon("fr.soleil.lib.project.swing.log.info");
...@@ -74,6 +75,10 @@ public class LevelListCellRenderer extends LightSelectionBackgroundListCellRende ...@@ -74,6 +75,10 @@ public class LevelListCellRenderer extends LightSelectionBackgroundListCellRende
Level level = (Level) value; Level level = (Level) value;
text = level.getLowerCaseName(); text = level.getLowerCaseName();
switch (level) { switch (level) {
case FATAL:
fg = FATAL_COLOR;
icon = FATAL_ICON;
break;
case ERROR: case ERROR:
fg = ERROR_COLOR; fg = ERROR_COLOR;
icon = ERROR_ICON; icon = ERROR_ICON;
......
...@@ -7,6 +7,7 @@ fr.soleil.lib.project.swing.log.pause=fr/soleil/lib/project/swing/icons/log_paus ...@@ -7,6 +7,7 @@ fr.soleil.lib.project.swing.log.pause=fr/soleil/lib/project/swing/icons/log_paus
fr.soleil.lib.project.swing.log.resume=fr/soleil/lib/project/swing/icons/log_play.png fr.soleil.lib.project.swing.log.resume=fr/soleil/lib/project/swing/icons/log_play.png
fr.soleil.lib.project.swing.log.all=fr/soleil/lib/project/swing/icons/all_log_levels.png fr.soleil.lib.project.swing.log.all=fr/soleil/lib/project/swing/icons/all_log_levels.png
fr.soleil.lib.project.swing.log.error=fr/soleil/lib/project/swing/icons/error.png fr.soleil.lib.project.swing.log.error=fr/soleil/lib/project/swing/icons/error.png
fr.soleil.lib.project.swing.log.fatal=FatCow_Icons16x16/skull_old.png
fr.soleil.lib.project.swing.log.warning=fr/soleil/lib/project/swing/icons/warn.png fr.soleil.lib.project.swing.log.warning=fr/soleil/lib/project/swing/icons/warn.png
fr.soleil.lib.project.swing.log.info=fr/soleil/lib/project/swing/icons/info.png fr.soleil.lib.project.swing.log.info=fr/soleil/lib/project/swing/icons/info.png
fr.soleil.lib.project.swing.log.debug=com/famfamfam/silk/bug.png fr.soleil.lib.project.swing.log.debug=com/famfamfam/silk/bug.png
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment