-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.go
54 lines (47 loc) · 1.05 KB
/
info.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
package egolog
type InfoLog map[string]interface{}
const (
InfoLogPath = "path"
InfoLogName = "name"
InfoLogPrefix = "prefix"
InfoLogMessage = "message"
)
// Get Получение значения по ключу из таблицы
func (info InfoLog) Get(key string) interface{} {
if value, ok := info[key]; ok {
return value
}
return nil
}
// Path Вернуть путь до файла
func (info InfoLog) Path() string {
value := info.Get(InfoLogPath)
if value != nil {
return value.(string)
}
return ""
}
// Name Вернуть имя файла
func (info InfoLog) Name() string {
value := info.Get(InfoLogName)
if value != nil {
return value.(string)
}
return ""
}
// Prefix Вернуть префикс лога
func (info InfoLog) Prefix() string {
value := info.Get(InfoLogPrefix)
if value != nil {
return value.(string)
}
return ""
}
// Message Вернуть сообщение лога
func (info InfoLog) Message() string {
value := info.Get(InfoLogMessage)
if value != nil {
return value.(string)
}
return ""
}