/
get.go
58 lines (48 loc) · 840 Bytes
/
get.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
package logger
import "strings"
func getParent(lo Logger) (log Logger) {
// Return root if root
if lo == defroot {
log = defroot
return
}
s := strings.Split(string(lo), defseperator)
// Return root if first level logger
if len(s) == 1 {
log = defroot
return
}
// Return root if parent is empty
if s[0] == "" {
log = defroot
return
}
l := len(s) - 1
z := s[0:l]
log = Logger(strings.Join(z, defseperator))
return
}
func getPriorityFormat(pr Priority) (col, fom int) {
switch pr {
case Debug:
col = colornone
case Notice:
col = colorgreen
case Info:
col = colorblue
case Warning:
col = coloryellow
case Error:
col = coloryellow
fom = textbold
case Critical:
col = colorred
case Alert:
col = colorred
fom = textbold
case Emergency:
col = colorred
fom = textblink
}
return
}