forked from clyhs/gopcp.v2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xfields.go
114 lines (94 loc) · 2.48 KB
/
xfields.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
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
114
// generated by log_xfields_generator -input /home/haolin/golang/example.v2/src/gopcp.v2/helper/log/field -output /home/haolin/golang/example.v2/src/gopcp.v2/helper/log/field
// generation time: 2016-12-29T12:10:06.552
// DO NOT EDIT!!
package field
// 拥有bool类型的值的日志字段。
type boolField struct {
name string
fieldType FieldType
value bool
}
func (field *boolField) Name() string {
return field.name
}
func (field *boolField) Type() FieldType {
return field.fieldType
}
func (field *boolField) Value() interface{} {
return field.value
}
func Bool(name string, value bool) Field {
return &boolField{name: name, fieldType: BoolType, value: value}
}
// 拥有int64类型的值的日志字段。
type int64Field struct {
name string
fieldType FieldType
value int64
}
func (field *int64Field) Name() string {
return field.name
}
func (field *int64Field) Type() FieldType {
return field.fieldType
}
func (field *int64Field) Value() interface{} {
return field.value
}
func Int64(name string, value int64) Field {
return &int64Field{name: name, fieldType: Int64Type, value: value}
}
// 拥有float64类型的值的日志字段。
type float64Field struct {
name string
fieldType FieldType
value float64
}
func (field *float64Field) Name() string {
return field.name
}
func (field *float64Field) Type() FieldType {
return field.fieldType
}
func (field *float64Field) Value() interface{} {
return field.value
}
func Float64(name string, value float64) Field {
return &float64Field{name: name, fieldType: Float64Type, value: value}
}
// 拥有string类型的值的日志字段。
type stringField struct {
name string
fieldType FieldType
value string
}
func (field *stringField) Name() string {
return field.name
}
func (field *stringField) Type() FieldType {
return field.fieldType
}
func (field *stringField) Value() interface{} {
return field.value
}
func String(name string, value string) Field {
return &stringField{name: name, fieldType: StringType, value: value}
}
// 拥有interface{}类型的值的日志字段。
type objectField struct {
name string
fieldType FieldType
value interface{}
}
func (field *objectField) Name() string {
return field.name
}
func (field *objectField) Type() FieldType {
return field.fieldType
}
func (field *objectField) Value() interface{} {
return field.value
}
func Object(name string, value interface{}) Field {
return &objectField{name: name, fieldType: ObjectType, value: value}
}