-
Notifications
You must be signed in to change notification settings - Fork 303
/
testing.go
59 lines (47 loc) · 1.11 KB
/
testing.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
48
49
50
51
52
53
54
55
56
57
58
59
package logstore
import (
"time"
"github.com/tilt-dev/tilt/pkg/logger"
"github.com/tilt-dev/tilt/pkg/model"
)
type testLogEvent struct {
name model.ManifestName
level logger.Level
ts time.Time
fields logger.Fields
message string
}
func (l testLogEvent) Message() []byte {
return []byte(l.message)
}
func (l testLogEvent) Level() logger.Level {
return l.level
}
func (l testLogEvent) Time() time.Time {
return l.ts
}
func (l testLogEvent) ManifestName() model.ManifestName {
return l.name
}
func (l testLogEvent) Fields() logger.Fields {
return l.fields
}
func (l testLogEvent) SpanID() SpanID {
return SpanID(l.name)
}
func newGlobalTestLogEvent(message string) testLogEvent {
return newTestLogEvent("", time.Now(), message)
}
func newGlobalLevelTestLogEvent(message string, level logger.Level) testLogEvent {
event := newTestLogEvent("", time.Now(), message)
event.level = level
return event
}
func newTestLogEvent(name model.ManifestName, ts time.Time, message string) testLogEvent {
return testLogEvent{
name: name,
level: logger.InfoLvl,
ts: ts,
message: message,
}
}