Skip to content

Commit cee7d09

Browse files
committed
Add is*Enabled methods for log level checks to LogAccessor
Closes gh-22862
1 parent 0f55366 commit cee7d09

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

spring-core/src/main/java/org/springframework/core/log/LogAccessor.java

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,51 @@ public final Log getLog() {
6868
}
6969

7070

71+
// Log level checks
72+
73+
/**
74+
* Is fatal logging currently enabled?
75+
*/
76+
public boolean isFatalEnabled() {
77+
return this.log.isFatalEnabled();
78+
}
79+
80+
/**
81+
* Is error logging currently enabled?
82+
*/
83+
public boolean isErrorEnabled() {
84+
return this.log.isErrorEnabled();
85+
}
86+
87+
/**
88+
* Is warn logging currently enabled?
89+
*/
90+
public boolean isWarnEnabled() {
91+
return this.log.isWarnEnabled();
92+
}
93+
94+
/**
95+
* Is info logging currently enabled?
96+
*/
97+
public boolean isInfoEnabled() {
98+
return this.log.isInfoEnabled();
99+
}
100+
101+
/**
102+
* Is debug logging currently enabled?
103+
*/
104+
public boolean isDebugEnabled() {
105+
return this.log.isDebugEnabled();
106+
}
107+
108+
/**
109+
* Is trace logging currently enabled?
110+
*/
111+
public boolean isTraceEnabled() {
112+
return this.log.isTraceEnabled();
113+
}
114+
115+
71116
// Plain log methods
72117

73118
/**

0 commit comments

Comments
 (0)