9 Star 36 Fork 13

phachon / go-logger

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
logger_easyjson.go 4.08 KB
一键复制 编辑 原始数据 按行查看 历史
phachon 提交于 2018-04-24 18:44 . use easyjson
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package go_logger
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 easyjson22b64118DecodeGithubComPhachonGoLogger(in *jlexer.Lexer, out *loggerMessage) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "timestamp":
out.Timestamp = int64(in.Int64())
case "timestamp_format":
out.TimestampFormat = string(in.String())
case "millisecond":
out.Millisecond = int64(in.Int64())
case "millisecond_format":
out.MillisecondFormat = string(in.String())
case "level":
out.Level = int(in.Int())
case "level_string":
out.LevelString = string(in.String())
case "body":
out.Body = string(in.String())
case "file":
out.File = string(in.String())
case "line":
out.Line = int(in.Int())
case "function":
out.Function = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjson22b64118EncodeGithubComPhachonGoLogger(out *jwriter.Writer, in loggerMessage) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"timestamp\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Timestamp))
}
{
const prefix string = ",\"timestamp_format\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.TimestampFormat))
}
{
const prefix string = ",\"millisecond\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int64(int64(in.Millisecond))
}
{
const prefix string = ",\"millisecond_format\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.MillisecondFormat))
}
{
const prefix string = ",\"level\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int(int(in.Level))
}
{
const prefix string = ",\"level_string\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.LevelString))
}
{
const prefix string = ",\"body\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Body))
}
{
const prefix string = ",\"file\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.File))
}
{
const prefix string = ",\"line\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.Int(int(in.Line))
}
{
const prefix string = ",\"function\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Function))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v loggerMessage) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjson22b64118EncodeGithubComPhachonGoLogger(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v loggerMessage) MarshalEasyJSON(w *jwriter.Writer) {
easyjson22b64118EncodeGithubComPhachonGoLogger(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *loggerMessage) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjson22b64118DecodeGithubComPhachonGoLogger(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *loggerMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjson22b64118DecodeGithubComPhachonGoLogger(l, v)
}
Go
1
https://gitee.com/phachon/go-logger.git
git@gitee.com:phachon/go-logger.git
phachon
go-logger
go-logger
master

搜索帮助