File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,26 @@ assert(message == ContextStack.pop())
138
138
assert(ContextStack.empty)
139
139
----
140
140
141
+ A `CoroutineThreadContext` context element is provided to integrate logging context with coroutines.
142
+
143
+ [source,kotlin]
144
+ ----
145
+ launch(loggingContext(mapOf("myKey" to "myValue"), listOf("test"))) {
146
+ assertEquals("myValue", ContextMap["myKey"])
147
+ assertEquals("test", ContextStack.peek())
148
+ }
149
+ ----
150
+
151
+ or to preserve the existing context:
152
+
153
+ [source,kotlin]
154
+ ----
155
+ launch(additionalLoggingContext(mapOf("myKey" to "myValue"), listOf("test"))) {
156
+ assertEquals("myValue", ContextMap["myKey"])
157
+ assertEquals("test", ContextStack.peek())
158
+ }
159
+ ----
160
+
141
161
[#params]
142
162
== Parameter substitution
143
163
You can’t perform that action at this time.
0 commit comments