FocusSelection
public protocol FocusSelection
An implementation of FocusSelection is used to control what logging and debug info is currently being
produced. When the focus selection is empty (reset), all the normal logging levels apply and there is
no filtering.
Focusing on one or more features results in only logging related to the focused items being produced, automatically setting debug log level for those features and topic paths.
Topic Paths are used to allow control of non-Feature subsystems that have opted in to Contextual Logging. Feature identifiers are converted to Topic Paths so we have one common concept for logging hierarchy.
See
TopicPath
-
This is set to
trueif there is currently a non-empty focus selection, i.e. focus is being used. Whenfalsethis means all debug output should be includedDeclaration
Swift
var isActive: Bool { get } -
Test if something should be suppressed from output. This exists so that we can easily write:
guard !FlintInternal.focusSelection?.shouldSuppress(x) == true else { return }This way, if the selection is nil OR
xis not in the focus selection, we can get out concisely.- return:
trueif the specific topic path should not be output in logs or debug UI. Returnstrueonly if there is a selection AND the topic path is included in it
Declaration
Swift
func shouldSuppress(_ topicPath: TopicPath) -> Bool - return:
-
- return:
trueif the specified feature is in the current focus selection. This must be the case if any of its ancestor Features is in the focus selection. Returnsfalseif there is no selection, or there is a selection but the topic is not in it
Declaration
Swift
func isFocused(_ topicPath: TopicPath) -> Bool - return:
-
Called to add a feature to the focus selection
Declaration
Swift
func focus(_ topicPath: TopicPath) -
Called to add a feature to the focus selection
Declaration
Swift
func defocus(_ topicPath: TopicPath) -
Called to clear the focus and revert to standard behaviour
Declaration
Swift
func reset()
-
shouldSuppress(feature:)Extension methodUndocumented
Declaration
Swift
public func shouldSuppress(feature: FeatureDefinition.Type) -> Bool -
isFocused(feature:)Extension methodUndocumented
Declaration
Swift
public func isFocused(feature: FeatureDefinition.Type) -> Bool -
focus(feature:)Extension methodUndocumented
Declaration
Swift
public func focus(feature: FeatureDefinition.Type) -
defocus(feature:)Extension methodUndocumented
Declaration
Swift
public func defocus(feature: FeatureDefinition.Type)
View on GitHub
FocusSelection Protocol Reference