You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[PlaygroundLogger] Introduced LogPolicy, with support for capping the number of children logged.
The defaults are to log up to the first 10,000 children of "aggregates" (i.e. classes, structs, etc.) and up to the first 80 + last 20 of "containers" (i.e. arrays, dictionaries, sets, etc.).
This matches the behavior of the legacy PlaygroundLogger.
This commit includes introducing new tests that these policies are applied correctly.
// TODO: need to handle optionals better (e.g. implicitly unwrap optionality, I think)
29
29
30
30
// Returns either the passed-in type name/summary or the type name/summary of `instance`.
@@ -47,7 +47,7 @@ extension LogEntry {
47
47
48
48
// If a type implements the `debugQuickLookObject()` Objective-C method, then get their debug quick look object and use that for logging (by passing it back through this initializer).
/// Indicates that no more than the first `count` children should be logged.
20
+
case head(count:Int)
21
+
/// Indicates that no more than the first `headCount` and last `tailCount` children should be logged.
22
+
case headTail(headCount:Int, tailCount:Int)
23
+
/// Indicates that no children should be logged.
24
+
case none
25
+
}
26
+
27
+
/// The policy for logging children of aggregates (e.g. classes, structs, enums, tuples).
28
+
varaggregateChildPolicy:ChildPolicy
29
+
30
+
/// The policy for logging children of containers (e.g. optionals, collections, dictionaries, sets).
31
+
varcontainerChildPolicy:ChildPolicy
32
+
33
+
/// Initializes a new `LogPolicy`.
34
+
///
35
+
/// - parameter aggregateChildPolicy: The policy to use for logging children of aggregates. Defaults to logging no more than the first 10,000 children.
36
+
/// - parameter containerChildPolicy: The policy to use for logging children of collections. Defaults to logging no more than the first 80 children plus the last 20 children.
0 commit comments