// Dict adds the field key with a dict to the event context.
// Use zerolog.Dict() to create the dictionary.
495172
func (e *Event) Dict(key string, dict *Event) *Event {
	if e == nil {
		return e
	}
	dict.buf = enc.AppendEndMarker(dict.buf)
	e.buf = append(enc.AppendKey(e.buf, key), dict.buf...)
	putEvent(dict)
	return e
}
1041030
func (e *Event) Str(key, val string) *Event {
	if e == nil {
		return e
	}
	e.buf = enc.AppendString(enc.AppendKey(e.buf, key), val)
	return e
}
257437
func LoadDefaultDict() (*Dict, error) {
	_, filename, _, _ := runtime.Caller(0)
	return LoadDict(path.Join(path.Dir(filename), "tdict-std.txt"))
}
518060
func FieldsFromContext(ctx context.Context) map[string]interface{} {
	m := make(map[string]interface{})
	v := ctx.Value(RequestIDContextKey)
	if v != nil {
		m[log.FnRequestID] = v.(string)
	}
	return m
}
293638
func (c Context) Hex(key string, val []byte) Context {
	c.l.context = enc.AppendHex(enc.AppendKey(c.l.context, key), val)
	return c
}
977430
func getDictField(dict reflect.Value, key string) dictField {
	// get valuev as a map value or as a struct field
	switch dict.Kind() {
	case reflect.Map:
		value := reflect.New(dict.Type().Elem()).Elem()
		return dictField{
			Value: value,
			Ok:    true,
			Set: func() {
				if dict.IsNil() {
					dict.Set(reflect.MakeMap(dict.Type()))
				}
				// Assigns the value into the map.
				dict.SetMapIndex(reflect.ValueOf(key).Convert(dict.Type().Key()), value)
			},
		}
	case reflect.Struct:
		sf, ok := getStructFieldForKey(dict.Type(), key)
		if !ok {
			return dictField{}
		}
		if sf.r.PkgPath != "" {
			panic(&UnmarshalFieldError{
				Key:   key,
				Type:  dict.Type(),
				Field: sf.r,
			})
		}
		return dictField{
			Value: dict.FieldByIndex(sf.r.Index),
			Ok:    true,
			Set:   func() {},
			IgnoreUnmarshalTypeError: sf.tag.IgnoreUnmarshalTypeError(),
		}
	default:
		return dictField{}
	}
}
128395
func decode(record *Record, event *Event) error {
	r, err := gzip.NewReader(bytes.NewReader(record.AWSLogs.Data))
	if err != nil {
		return err
	}

	if err = json.NewDecoder(r).Decode(&event); err != nil {
		return err
	}

	if err := r.Close(); err != nil {
		return err
	}

	return nil
}
1017727
func (k *KeyLogger) Read() chan InputEvent {
	event := make(chan InputEvent)
	go func(event chan InputEvent) {
		for {
			e, err := k.read()
			if err != nil {
				logrus.Error(err)
				close(event)
				break
			}

			if e != nil {
				event <- *e
			}
		}
	}(event)
	return event
}
1284083
func (ef *File) Events() (cgem chan *GoEvtxMap) {
	cgem = make(chan *GoEvtxMap, 1)
	go func() {
		defer close(cgem)
		for c := range ef.Chunks() {
			for e := range c.Events() {
				cgem <- e
			}
		}
	}()
	return
}
652129
func (handler *Handler) Event(logEvent *event.Event) error {
	handler.mutex.Lock()
	handler.events = append(handler.events, logEvent)
	handler.mutex.Unlock()
	return nil
}
500909
func (a *Array) Object(obj LogObjectMarshaler) *Array {
	e := Dict()
	obj.MarshalZerologObject(e)
	e.buf = enc.AppendEndMarker(e.buf)
	a.buf = append(enc.AppendArrayDelim(a.buf), e.buf...)
	putEvent(e)
	return a
}
1329524
func (lc *logContext) onEvent(le *Event) {
	appenders := lc.appenders
	if len(appenders) == 1 {
		appenders[0].Append(le)
		return
	}
	for _, a := range appenders {
		a.Append(le)
	}
}
1233095
func (in *GenericWebHookEvent) DeepCopy() *GenericWebHookEvent {
	if in == nil {
		return nil
	}
	out := new(GenericWebHookEvent)
	in.DeepCopyInto(out)
	return out
}
1358785
func (c *config) log(event Event, err error, args ...interface{}) {
	if c.lfunc != nil {
		c.lfunc(event, err, args...)
	}
}
225993
func (p *PreviousGtidsLogEventParser) Parse(raw *RawV4Event) (Event, error) {
	pgle := &PreviousGtidsLogEvent{
		Event: raw,
		set:   make(map[string][]GtidRange),
	}

	data := raw.VariableLengthData()
	if len(data) < 8 {
		return nil, errors.Newf("Not enough bytes for n_sids: %v", data)
	}

	nSids, data := LittleEndian.Uint64(data[:8]), data[8:]
	for i := uint64(0); i < nSids; i++ {
		if len(data) < 16 {
			return nil, errors.Newf("Not enough bytes for sid: %v", data)
		}

		var sid string
		sid, data = string(data[:16]), data[16:]
		if len(data) < 8 {
			return nil, errors.Newf("Not enough bytes for n_intervals: %v", data)
		}

		var nIntervals uint64
		nIntervals, data = LittleEndian.Uint64(data[:8]), data[8:]
		for j := uint64(0); j < nIntervals; j++ {
			if len(data) < 16 {
				return nil, errors.Newf("Not enough bytes for start/end: %v", data)
			}

			var start, end uint64
			start, data = LittleEndian.Uint64(data[:8]), data[8:]
			end, data = LittleEndian.Uint64(data[:8]), data[8:]

			pgle.set[sid] = append(pgle.set[sid], GtidRange{start, end})
		}
	}

	if len(data) > 0 {
		return nil, errors.Newf("Extra bytes at the end: %v", data)
	}

	return pgle, nil
}
617206
func (c *Context) Header(key, value string) {
	if value == "" {
		c.Writer.Header().Del(key)
		return
	}
	c.Writer.Header().Set(key, value)
}
1281195
func WithField(key string, value interface{}) *logrus.Entry {
	return logger.WithField(key, value)
}