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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
package config
import "github.com/mimecast/dtail/internal/color"
// ClientColorConfig allows to override the default terminal color color.
type termColors struct {
ClientErrorAttr color.Attribute
ClientErrorBg color.BgColor
ClientErrorFg color.FgColor
ClientStatsAttr color.Attribute
ClientStatsBg color.BgColor
ClientStatsFg color.FgColor
ClientWarnAttr color.Attribute
ClientWarnBg color.BgColor
ClientWarnFg color.FgColor
RemoteDebugAttr color.Attribute
RemoteDebugBg color.BgColor
RemoteDebugFg color.FgColor
RemoteErrorAttr color.Attribute
RemoteErrorBg color.BgColor
RemoteErrorFg color.FgColor
RemoteFatalAttr color.Attribute
RemoteFatalBg color.BgColor
RemoteFatalFg color.FgColor
RemoteStatsOkAttr color.Attribute
RemoteStatsOkBg color.BgColor
RemoteStatsOkFg color.FgColor
RemoteStatsWarnAttr color.Attribute
RemoteStatsWarnBg color.BgColor
RemoteStatsWarnFg color.FgColor
RemoteTextAttr color.Attribute
RemoteTextBg color.BgColor
RemoteTextFg color.FgColor
RemoteTraceAttr color.Attribute
RemoteTraceBg color.BgColor
RemoteTraceFg color.FgColor
RemoteWarnAttr color.Attribute
RemoteWarnBg color.BgColor
RemoteWarnFg color.FgColor
}
// ClientConfig represents a DTail client configuration (empty as of now as there
// are no available config options yet, but that may changes in the future).
type ClientConfig struct {
TermColorsEnabled bool
TermColors termColors `json:",omitempty"`
}
// Create a new default client configuration.
func newDefaultClientConfig() *ClientConfig {
return &ClientConfig{
TermColorsEnabled: true,
TermColors: termColors{
ClientErrorAttr: color.AttrBold,
ClientErrorBg: color.BgBlack,
ClientErrorFg: color.FgRed,
ClientStatsAttr: color.AttrDim,
ClientStatsBg: color.BgBlue,
ClientStatsFg: color.FgWhite,
ClientWarnAttr: color.AttrNone,
ClientWarnBg: color.BgBlack,
ClientWarnFg: color.FgMagenta,
RemoteDebugAttr: color.AttrNone,
RemoteDebugBg: color.BgGreen,
RemoteDebugFg: color.FgBlack,
RemoteErrorAttr: color.AttrBold,
RemoteErrorBg: color.BgRed,
RemoteErrorFg: color.FgWhite,
RemoteFatalAttr: color.AttrBlink,
RemoteFatalBg: color.BgRed,
RemoteFatalFg: color.FgWhite,
RemoteStatsOkAttr: color.AttrNone,
RemoteStatsOkBg: color.BgGreen,
RemoteStatsOkFg: color.FgBlack,
RemoteStatsWarnAttr: color.AttrNone,
RemoteStatsWarnBg: color.BgRed,
RemoteStatsWarnFg: color.FgWhite,
RemoteTextAttr: color.AttrNone,
RemoteTextBg: color.BgBlack,
RemoteTextFg: color.FgWhite,
RemoteTraceAttr: color.AttrBold,
RemoteTraceBg: color.BgGreen,
RemoteTraceFg: color.FgWhite,
RemoteWarnAttr: color.AttrBold,
RemoteWarnBg: color.BgYellow,
RemoteWarnFg: color.FgWhite,
},
}
}
|