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] Implemented support for capping the depth of log entries.
This pulls over behavior matching the legacy PlaygroundLogger, which capped log entries at a maximum depth of 2.
This includes commits for a small handful of cases. More to be added later.
// 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).
// We don't consume a level of depth for optionals or dictionaries.
155
+
// We don't want optional to count as a level of depth as we would quickly end up with gaps.
156
+
// We don't want dictionary to count as a level of depth as dictionary is modeled as a collection of (key, value) pairs, and we don't want to lose a level due to the pairs themselves consuming a level, so for ease of bookkeeping the dictionary level is counted as not consuming a level.
Copy file name to clipboardExpand all lines: PlaygroundLogger/PlaygroundLogger/LogPolicy.swift
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,9 @@
13
13
structLogPolicy{
14
14
staticlet`default`:LogPolicy=LogPolicy()
15
15
16
+
/// The policy for the maximum depth level for log entries.
17
+
varmaximumDepth:Int
18
+
16
19
enumChildPolicy{
17
20
/// Indicates that all children should be logged.
18
21
case all
@@ -32,10 +35,13 @@ struct LogPolicy {
32
35
33
36
/// Initializes a new `LogPolicy`.
34
37
///
38
+
/// - parameter maximumDepth: The maximum depth level for logging children of children. Defaults to 2.
35
39
/// - parameter aggregateChildPolicy: The policy to use for logging children of aggregates. Defaults to logging no more than the first 10,000 children.
36
40
/// - 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