Skip to content
This repository was archived by the owner on Jun 14, 2023. It is now read-only.

Commit 4af380c

Browse files
authored
Add Log concepts and document (#112)
1 parent 6c4fc8f commit 4af380c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,21 @@ may use them to aggregate metrics, generate topology map and etc.
183183

184184
They are defined as constant in root package with prefix `Tag`.
185185

186+
## Log x Trace context
187+
188+
Inject trace context into the log text. SkyWalking LAL(log analysis language) engine could extract the context from the text and correlate trace and logs.
189+
190+
```go
191+
// Get trace context data
192+
import go2skylog "github.com/SkyAPM/go2sky/log"
193+
logContext = go2skylog.FromContext(ctx)
194+
195+
// Build context data string
196+
// Inject context string into log
197+
// Context format string: [$serviceName,$instanceName,$traceId,$traceSegmentId,$spanId]
198+
contextString := logContext.String()
199+
```
200+
186201
## Plugins
187202

188203
Go to go2sky-plugins repo to see all the plugins, [click here](https://github.com/SkyAPM/go2sky-plugins).

0 commit comments

Comments
 (0)