forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make isTraceEnabled calls be computed at build time quarkusio#12938
- Loading branch information
Showing
4 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
core/runtime/src/main/java/io/quarkus/runtime/logging/CategoryBuildTimeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.quarkus.runtime.logging; | ||
|
||
import io.quarkus.runtime.annotations.ConfigGroup; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
|
||
@ConfigGroup | ||
public class CategoryBuildTimeConfig { | ||
/** | ||
* Specifies whether <code>isTraceEnabled</code> for a given category will return true or false for a given category. | ||
* This check is computed at build time to provide better hints on code paths that won't be used at runtime. | ||
* | ||
* It's common to see <code>isTraceEnabled</code> calls in sections that include building complex or expensive messages. | ||
* By using <code>isTraceEnabled</code> checks, users can double check that trace enabled before computing such a message. | ||
* Otherwise, complex messages could be constructed but then not used by the logging library if the runtime log level is not trace. | ||
* This build time option controls whether `isTraceEnabled` returns true or false at build time and makes that a constant at runtime, | ||
* irrespective of the runtime log level. | ||
* | ||
* Calls to <code>trace()</code> not preceded by <code>isTraceEnabled</code> are still governed by the runtime log level. | ||
* The message will only be printed if runtime log level for a given category is <code>TRACE</code>. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
public boolean buildTimeTraceEnabled; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters