Skip to content

Commit e29bd1d

Browse files
authored
Merge pull request #25 from takahirom/tm/add-before-context-size-docs
Add beforeContextSize documentation
2 parents f467b95 + 7d32555 commit e29bd1d

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,25 @@ dependencies {
8484

8585
## 🎛️ Advanced Configuration
8686

87+
### Context Display with beforeContextSize
88+
89+
Show preceding method calls even when they don't match your filter:
90+
91+
```kotlin
92+
.filter { event -> event.methodName == "inner" }
93+
.beforeContextSize(1) // Show 1 preceding event for context
94+
```
95+
96+
**Output:**
97+
```
98+
→ SimpleNestedHierarchy.middle() // Context (doesn't match filter)
99+
→ SimpleNestedHierarchy.inner() // Matches filter
100+
← SimpleNestedHierarchy.inner
101+
← SimpleNestedHierarchy.middle
102+
```
103+
104+
Useful for debugging: See what led to specific method calls, track where null values originated, or understand deep call chains.
105+
87106
### Custom Formatting
88107

89108
Want custom formatting? Configure it easily:
@@ -136,21 +155,6 @@ codePathTrace(customTracer) {
136155
}
137156
```
138157

139-
### Filtering Examples
140-
141-
```kotlin
142-
// Trace only your app code
143-
.filter { event -> event.className.startsWith("com.mycompany") }
144-
145-
// Skip common methods
146-
.filter { event ->
147-
!listOf("toString", "hashCode", "equals").contains(event.methodName)
148-
}
149-
150-
// Focus on specific depth levels
151-
.filter { event -> event.depth < 3 }
152-
```
153-
154158

155159
## 🏃‍♂️ Quick Verification
156160

0 commit comments

Comments
 (0)