-
Notifications
You must be signed in to change notification settings - Fork 0
/
json_glogger_easyjson.go
79 lines (74 loc) · 1.71 KB
/
json_glogger_easyjson.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
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package glog
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjsonC5e9d7b4EncodeGithubComRicVGlog(out *jwriter.Writer, in LoggerJson) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"time\":"
out.RawString(prefix[1:])
out.String(string(in.Time))
}
{
const prefix string = ",\"type\":"
out.RawString(prefix)
out.String(string(in.Type))
}
{
const prefix string = ",\"file\":"
out.RawString(prefix)
out.String(string(in.File))
}
{
const prefix string = ",\"line\":"
out.RawString(prefix)
out.String(string(in.Line))
}
{
const prefix string = ",\"msg\":"
out.RawString(prefix)
if in.Msg == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
out.RawString(`null`)
} else {
out.RawByte('{')
v2First := true
for v2Name, v2Value := range in.Msg {
if v2First {
v2First = false
} else {
out.RawByte(',')
}
out.String(string(v2Name))
out.RawByte(':')
if m, ok := v2Value.(easyjson.Marshaler); ok {
m.MarshalEasyJSON(out)
} else if m, ok := v2Value.(json.Marshaler); ok {
out.Raw(m.MarshalJSON())
} else {
out.Raw(json.Marshal(v2Value))
}
}
out.RawByte('}')
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v LoggerJson) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5e9d7b4EncodeGithubComRicVGlog(&w, v)
return w.Buffer.BuildBytes(), w.Error
}