Skip to content

Commit

Permalink
implemented setDebugLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
cyklon73 committed Mar 17, 2024
1 parent d0e9667 commit 30791b0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/java/de/cyklon/jevent/EventManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,27 @@ default void registerParameterInstance(@NotNull Object instance) {
*/
@Nullable
Object getParameterInstance(String key);

/**
* Sets a logger for debug prints
* <p>
* example for java.util.logging and SLF4J:
* <pre>{@code
* public class Main {
*
* public static void main(String[] args) {
* EventManager manager = JEvent.getDefaultManager();
*
* //java.util.logging
* manager.setDebugLogger(msg -> logger.log(Level.FINE, msg));
*
* //SLF4J
* manager.setDebugLogger(logger::debug);
* }
*
* }
* }</pre>
* @param logger the consumer with the corresponding log method or null to disable debug messages
*/
void setDebugLogger(@Nullable Consumer<String> logger);
}

0 comments on commit 30791b0

Please sign in to comment.