Skip to content

Commit a5b91eb

Browse files
committed
Return ALL_LEVELS in LogbackLogging
Replace dynamic resolution of logging levels with the ALL_LEVELS constant in getSupportedLoggingLevels. Update tests to import ALL_LEVELS, add a test for constant values (PRIORITY and ALL_LEVELS/LOGBACK_LEVELS), and remove redundant assertions from testGetPriority. This simplifies level retrieval and centralizes level definitions for consistency.
1 parent 3598c82 commit a5b91eb

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

microsphere-logging-logback/src/main/java/io/microsphere/logging/logback/LogbackLogging.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public List<String> getLoggerNames() {
6363

6464
@Override
6565
public Set<String> getSupportedLoggingLevels() {
66-
return INSTANCE.resolve(Level.class);
66+
return ALL_LEVELS;
6767
}
6868

6969
@Override

microsphere-logging-logback/src/test/java/io/microsphere/logging/logback/LogbackLoggingTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import static io.microsphere.collection.Sets.ofSet;
2828
import static io.microsphere.lang.Prioritized.NORMAL_PRIORITY;
2929
import static io.microsphere.logging.LoggerFactory.getLogger;
30+
import static io.microsphere.logging.logback.LogbackLogging.ALL_LEVELS;
3031
import static io.microsphere.logging.logback.LogbackLogging.PRIORITY;
3132
import static org.junit.jupiter.api.Assertions.assertEquals;
3233
import static org.junit.jupiter.api.Assertions.assertFalse;
@@ -56,6 +57,13 @@ void setUp() {
5657
this.logging = new LogbackLogging();
5758
}
5859

60+
@Test
61+
void testConstants() {
62+
assertEquals(0, PRIORITY);
63+
assertEquals(NORMAL_PRIORITY, PRIORITY);
64+
assertEquals(LOGBACK_LEVELS, ALL_LEVELS);
65+
}
66+
5967
@Test
6068
void testGetLoggerNames() {
6169
assertFalse(this.logging.getLoggerNames().isEmpty());
@@ -101,8 +109,6 @@ void testGetName() {
101109

102110
@Test
103111
void testGetPriority() {
104-
assertEquals(0, PRIORITY);
105-
assertEquals(NORMAL_PRIORITY, PRIORITY);
106112
assertEquals(PRIORITY, this.logging.getPriority());
107113
}
108114
}

0 commit comments

Comments
 (0)