summaryrefslogtreecommitdiff
path: root/internal/config/client.go
blob: 05e4f93ad0c478d4afafbdca1e18fe3810ae39e9 (plain)
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
110
111
112
113
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
	ClientWarnAttr      color.Attribute
	ClientWarnBg        color.BgColor
	ClientWarnFg        color.FgColor
	DelimiterAttr       color.Attribute
	DelimiterBg         color.BgColor
	DelimiterFg         color.FgColor
	RemoteCountAttr     color.Attribute
	RemoteCountBg       color.BgColor
	RemoteCountFg       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
	RemoteIdAttr        color.Attribute
	RemoteIdBg          color.BgColor
	RemoteIdFg          color.FgColor
	RemoteServerAttr    color.Attribute
	RemoteServerBg      color.BgColor
	RemoteServerFg      color.FgColor
	RemoteStatsOkAttr   color.Attribute
	RemoteStatsOkBg     color.BgColor
	RemoteStatsOkFg     color.FgColor
	RemoteStatsWarnAttr color.Attribute
	RemoteStatsWarnBg   color.BgColor
	RemoteStatsWarnFg   color.FgColor
	RemoteStrAttr       color.Attribute
	RemoteStrBg         color.BgColor
	RemoteStrFg         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 {
	TermColorsEnable bool
	TermColors       termColors `json:",omitempty"`
}

// Create a new default client configuration.
func newDefaultClientConfig() *ClientConfig {
	return &ClientConfig{
		TermColorsEnable: true,
		TermColors: termColors{
			ClientErrorAttr:     color.AttrBold,
			ClientErrorBg:       color.BgBlack,
			ClientErrorFg:       color.FgRed,
			ClientWarnAttr:      color.AttrNone,
			ClientWarnBg:        color.BgBlack,
			ClientWarnFg:        color.FgMagenta,
			DelimiterAttr:       color.AttrDim,
			DelimiterBg:         color.BgBlue,
			DelimiterFg:         color.FgCyan,
			RemoteCountAttr:     color.AttrDim,
			RemoteCountBg:       color.BgBlue,
			RemoteCountFg:       color.FgGreen,
			RemoteDebugAttr:     color.AttrBold,
			RemoteDebugBg:       color.BgBlack,
			RemoteDebugFg:       color.FgGreen,
			RemoteErrorAttr:     color.AttrBold,
			RemoteErrorBg:       color.BgRed,
			RemoteErrorFg:       color.FgWhite,
			RemoteFatalAttr:     color.AttrBlink,
			RemoteFatalBg:       color.BgRed,
			RemoteFatalFg:       color.FgWhite,
			RemoteIdAttr:        color.AttrDim,
			RemoteIdBg:          color.BgBlue,
			RemoteIdFg:          color.FgWhite,
			RemoteServerAttr:    color.AttrBold,
			RemoteServerBg:      color.BgBlue,
			RemoteServerFg:      color.FgWhite,
			RemoteStatsOkAttr:   color.AttrNone,
			RemoteStatsOkBg:     color.BgGreen,
			RemoteStatsOkFg:     color.FgBlue,
			RemoteStatsWarnAttr: color.AttrNone,
			RemoteStatsWarnBg:   color.BgRed,
			RemoteStatsWarnFg:   color.FgWhite,
			RemoteStrAttr:       color.AttrDim,
			RemoteStrBg:         color.BgBlue,
			RemoteStrFg:         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,
		},
	}
}