-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from avaje/feature/eventLog
Add EventLog interface with preInitialisation() and postInitialisation() support
- Loading branch information
Showing
11 changed files
with
134 additions
and
53 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
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,24 @@ | ||
package io.avaje.config; | ||
|
||
import io.avaje.applog.AppLog; | ||
|
||
import java.lang.System.Logger.Level; | ||
|
||
/** | ||
* Default implementation of EventLog just uses System.Logger. | ||
*/ | ||
final class DefaultEventLog implements EventLog { | ||
|
||
private final System.Logger log = AppLog.getLogger("io.avaje.config"); | ||
|
||
@Override | ||
public void log(Level level, String message, Throwable thrown) { | ||
log.log(level, message, thrown); | ||
} | ||
|
||
@Override | ||
public void log(Level level, String message, Object... args) { | ||
log.log(level, message, args); | ||
} | ||
|
||
} |
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,40 @@ | ||
package io.avaje.config; | ||
|
||
import java.lang.System.Logger.Level; | ||
|
||
/** | ||
* Configuration events are sent to this event log. | ||
* <p> | ||
* The EventLog implementation can be provided by ServiceLoader and then can | ||
* control how the events are logged. For example, it might delay logging messages | ||
* until logging implementation has finished configuration. | ||
*/ | ||
public interface EventLog { | ||
|
||
/** | ||
* Invoked when the configuration is being initialised. | ||
*/ | ||
default void preInitialisation() { | ||
// do nothing by default | ||
} | ||
|
||
/** | ||
* Invoked when the initialisation of configuration has been completed. | ||
*/ | ||
default void postInitialisation() { | ||
// do nothing by default | ||
} | ||
|
||
/** | ||
* Log an event with the given level, message, and thrown exception. | ||
*/ | ||
void log(Level level, String message, Throwable thrown); | ||
|
||
/** | ||
* Log an event with the given level, formatted message, and arguments. | ||
* <p> | ||
* The message format is as per {@link java.text.MessageFormat#format(String, Object...)}. | ||
*/ | ||
void log(Level level, String message, Object... args); | ||
|
||
} |
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
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
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
Oops, something went wrong.