public class LoggingStateRepository extends Object implements StateRepository
StateRepository which adds logging capabilities to an existing repository. You should
consider using this class if you want to log all feature toggled events.| Modifier | Constructor and Description |
|---|---|
|
LoggingStateRepository(StateRepository delegate)
Creates a logging facade for the supplied
StateRepository. |
protected |
LoggingStateRepository(StateRepository delegate,
Log log) |
|
LoggingStateRepository(StateRepository delegate,
String customLogMessage)
Creates a logging facade for the supplied
StateRepository using a custom log message. |
protected |
LoggingStateRepository(StateRepository delegate,
String customLogMessage,
Log log) |
| Modifier and Type | Method and Description |
|---|---|
FeatureState |
getFeatureState(Feature feature)
Get the persisted state of a feature from the repository.
|
void |
setFeatureState(FeatureState featureState)
Persist the supplied feature state.
|
public LoggingStateRepository(StateRepository delegate)
StateRepository.delegate - The repository to delegate invocations topublic LoggingStateRepository(StateRepository delegate, String customLogMessage)
StateRepository using a custom log message. In your custom log message,
mark the position of the feature name as {1} and the position for the new feature state which will be replaced by
"enabled" or "disabled" as {2}.delegate - The repository to delegate invocations tocustomLogMessage - Your custom log message. It may contain a placeholder {1} for the feature name and a placeholder
{2} for the new feature state which will be replaced by "enabled" or "disabled"protected LoggingStateRepository(StateRepository delegate, Log log)
protected LoggingStateRepository(StateRepository delegate, String customLogMessage, Log log)
public FeatureState getFeatureState(Feature feature)
StateRepositorynull.getFeatureState in interface StateRepositoryfeature - The feature to read the state fornullpublic void setFeatureState(FeatureState featureState)
StateRepositoryStateRepository.getFeatureState(Feature) return the same state as persisted using this method.setFeatureState in interface StateRepositoryfeatureState - The feature state to persistCopyright © 2018. All Rights Reserved.