// ContextLoggerFields indicate to the context logger what data to log.
170435
func (t *Transaction) ContextLoggerFields() map[string]interface{} {
	return map[string]interface{}{
		"txID": t.ID.String(),
		"txCR": t.Created.String(),
	}
}
17993
func ToContext(ctx context.Context, logger *zap.Logger) context.Context {
	return ctxzap.ToContext(ctx, logger)
}
856883
func NewContextLogger(ctx context.Context, logger log.Logger) context.Context {
	return context.WithValue(ctx, ctxKeyLogger, logger)
}
242587
func (ctx *Context) LogHeaders() {
	ctx.Request.Header.VisitAll(func(k, v []byte) {
		ctx.Logger.Debugf("%s = [%s]\n", k, v)
	})
}
1291555
func WithLogContext(ctx context.Context, keyvals ...interface{}) context.Context {
	logger := ContextLogger(ctx)
	if logger == nil {
		return ctx
	}
	nl := logger.New(keyvals...)
	return WithLogger(ctx, nl)
}
1215404
func (s *UpdateByQueryService) StoredFields(storedFields ...string) *UpdateByQueryService {
	s.storedFields = storedFields
	return s
}
1145771
func GetFields(c context.Context) Fields {
	if ret, ok := c.Value(fieldsKey).(Fields); ok {
		return ret
	}
	return nil
}
174994
func (s *IndicesStatsService) FielddataFields(fielddataFields ...string) *IndicesStatsService {
	s.fielddataFields = append(s.fielddataFields, fielddataFields...)
	return s
}
271261
func LoggerFromContext(ctx context.Context) *zap.Logger {
	l, _ := ctx.Value(loggerKey).(*zap.Logger)
	return l
}
890320
func (c *Context) Log() *log.Entry {
	fields := log.Fields{"service": c.ServiceName}

	if Config.Debug {
		pc := make([]uintptr, 10)
		runtime.Callers(2, pc)
		f := runtime.FuncForPC(pc[0])
		fields["file"], fields["line"] = f.FileLine(pc[0])
		fields["func"] = f.Name()
	}

	if c.User.ID > 0 {
		fields["user"] = c.User.ID
	}
	if c.Chat.ID != 0 {
		fields["chat"] = c.Chat.ID
	}
	if c.Message != nil {
		fields["msg"] = c.Message.GetTextHash()
	}

	if c.ChosenInlineResult != nil {
		fields["chosenresult"] = c.ChosenInlineResult
	}

	if c.InlineQuery != nil {
		fields["inlinequery"] = c.InlineQuery
	}

	if c.Callback != nil {
		fields["callback"] = c.Callback.Data
		fields["callback_id"] = c.Callback.ID

		if c.Callback.Message.MsgID > 0 {
			fields["callback_msgid"] = c.Callback.Message.MsgID
		} else {
			fields["callback_inlinemsgid"] = c.Callback.Message.InlineMsgID
		}

	}

	if c.gin != nil {
		fields["url"] = c.gin.Request.Method + " " + c.gin.Request.URL.String()
		fields["ip"] = c.gin.Request.RemoteAddr
	}

	fields["domain"] = c.ServiceBaseURL.Host

	return log.WithFields(fields)
}
1198398
func ToContext(ctx context.Context, logger *zap.Logger) context.Context {
	l := &ctxLogger{
		logger: logger,
	}
	return context.WithValue(ctx, ctxMarkerKey, l)
}
215635
func LoggerFromContext(ctx context.Context) log.Logger {
	return ctx.Value(loggerIdKey).(log.Logger)
}
408600
func ContextParams(ctx context.Context) map[string]string {
	if p, ok := ctx.Value(paramsContextKey).(map[string]string); ok {
		return p
	}
	return map[string]string{}
}
390967
func WithJSON(values ...interface{}) ContextLogger {
	if len(values) == 1 {
		return &contextLogger{isTrue: true, data: values[0], formatter: jsonFormatter}
	}
	return &contextLogger{isTrue: true, data: values, formatter: jsonFormatter}
}
1251632
func (s *MultiTermvectorService) Fields(fields []string) *MultiTermvectorService {
	s.fields = fields
	return s
}
657408
func HandlerFields(entry *logrus.Entry, formatter *CustomFormatter) (interface{}, error) {
	var fields string

	// Without sorting no need to get keys from map into a string array.
	if formatter.DisableSorting {
		for key, value := range entry.Data {
			if key == "name" && formatter.Attributes.Contains("name") {
				continue
			}
			fields = fmt.Sprintf("%s %s=%v", fields, Color(entry, formatter, key), value)
		}
		return fields, nil
	}

	// Put keys in a string array and sort it.
	keys := make([]string, len(entry.Data))
	i := 0
	for k := range entry.Data {
		keys[i] = k
		i++
	}
	sort.Strings(keys)

	// Do the rest.
	for _, key := range keys {
		if key == "name" && formatter.Attributes.Contains("name") {
			continue
		}
		fields = fmt.Sprintf("%s %s=%v", fields, Color(entry, formatter, key), entry.Data[key])
	}
	return fields, nil
}
1043377
func (c *GroupRolloutActiveSetCall) Context(ctx context.Context) *GroupRolloutActiveSetCall {
	c.ctx_ = ctx
	return c
}