-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_test.go
47 lines (37 loc) · 1.36 KB
/
example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package slslog
import (
"context"
"go.opentelemetry.io/otel/trace"
)
func ExampleInfof() {
parent := context.Background()
s := trace.SpanFromContext(parent)
ctx := trace.ContextWithSpan(parent, s)
Infof(ctx, "%s", "test")
// Output:
// {"severity":"INFO","message":"test","trace":"service/slslog/trace/00000000000000000000000000000000","span":"service/slslog/span/0000000000000000"}
}
func ExampleWarningf() {
parent := context.Background()
s := trace.SpanFromContext(parent)
ctx := trace.ContextWithSpan(parent, s)
Warningf(ctx, "%s", "test")
// Output:
// {"severity":"WARNING","message":"test","trace":"service/slslog/trace/00000000000000000000000000000000","span":"service/slslog/span/0000000000000000"}
}
func ExampleErrorf() {
parent := context.Background()
s := trace.SpanFromContext(parent)
ctx := trace.ContextWithSpan(parent, s)
Errorf(ctx, "%s", "test")
// Output:
// {"severity":"ERROR","message":"test","trace":"service/slslog/trace/00000000000000000000000000000000","span":"service/slslog/span/0000000000000000"}
}
func ExampleCriticalf() {
parent := context.Background()
s := trace.SpanFromContext(parent)
ctx := trace.ContextWithSpan(parent, s)
Criticalf(ctx, "%s", "test")
// Output:
// {"severity":"CRITICAL","message":"test","trace":"service/slslog/trace/00000000000000000000000000000000","span":"service/slslog/span/0000000000000000"}
}