// WriteWith writes a ButlerLogBundle to the supplied recordio.Writer.
517461
func (w *Writer) WriteWith(fw recordio.Writer, b *logpb.ButlerLogBundle) error {
	data, err := proto.Marshal(b)
	if err != nil {
		entries := b.GetEntries()
		// TODO(tandrii, hinoka): leave just error after crbug.com/859995 is fixed.
		if len(entries) > 100 {
			return fmt.Errorf("butlerproto: failed to marshal Bundle of len %d with first 100 entries %s: %s",
				len(entries), entries[:100], err)
		} else {
			return fmt.Errorf("butlerproto: failed to marshal Bundle %s: %s", entries, err)
		}
	}

	return w.writeData(fw, logpb.ButlerMetadata_ButlerLogBundle, data)
}
1123375
func (s *agentLoggingStrategy) WriteLog(m params.LogRecord) error {
	level, _ := loggo.ParseLevel(m.Level)
	dbErr := errors.Annotate(s.dblogger.Log([]state.LogRecord{{
		Time:     m.Time,
		Entity:   s.entity,
		Version:  s.version,
		Module:   m.Module,
		Location: m.Location,
		Level:    level,
		Message:  m.Message,
	}}), "logging to DB failed")

	m.Entity = s.entity.String()
	fileErr := errors.Annotate(
		logToFile(s.fileLogger, s.filePrefix, m),
		"logging to logsink.log failed",
	)
	err := dbErr
	if err == nil {
		err = fileErr
	} else if fileErr != nil {
		err = errors.Errorf("%s; %s", dbErr, fileErr)
	}
	return err
}
373309
func (r *responseRecorderWithoutCloseNotify) Write(buf []byte) (int, error) {
	if r.err != nil {
		return 0, r.err
	}
	return r.Body.Write(buf)
}
1131464
func WithLog(e *logrus.Entry) Option {
	return func(opts *options) {
		opts.log = e
	}
}
278124
func (n *LevelLogger) Write(p []byte) (int, error) {
	if !n.Enabled() {
		return len(p), nil
	}
	n.Printf("%s", p)
	return len(p), nil
}
922932
func (e *Engine) WithLogger(log *zap.Logger) {
	fields := []zap.Field{}
	if e.nodeID != nil {
		fields = append(fields, zap.Int("node_id", *e.nodeID))
	}

	if e.engineID != nil {
		fields = append(fields, zap.Int("engine_id", *e.engineID))
	}
	fields = append(fields, zap.String("service", "storage-engine"))

	e.logger = log.With(fields...)
	e.sfile.WithLogger(e.logger)
	e.index.WithLogger(e.logger)
	e.engine.WithLogger(e.logger)
	e.retentionEnforcer.WithLogger(e.logger)
}
1355731
func WithCsvWriter(w *encoding.Writer, c io.Closer) WriterBuilder {
	return func(header []string) Writer {
		result := &writer{
			header:  header,
			builder: NewRecordBuilder(header),
			encoder: w,
			closer:  c,
		}
		result.err = result.encoder.Write(header)
		return result
	}
}
379773
func (mr *MockCounterVecMockRecorder) With(arg0 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "With", reflect.TypeOf((*MockCounterVec)(nil).With), arg0)
}
1161648
func LogWith(err error, logger log.Logger) error {
	logger.Lock()
	defer logger.Unlock()
	return unsafeLogWith(err, logger)
}
1352586
func WithField(key string, value interface{}) Entry {
	ne := newEntryWithFields(logFields)
	ne.Fields = append(ne.Fields, Field{Key: key, Value: value})
	return ne
}
754038
func (l *LogWriter) Write(p []byte) (n int, err error) {
	l.Lock()
	defer l.Unlock()

	// Strip off newlines at the end if there are any since we store
	// individual log lines in the agent.
	n = len(p)
	if p[n-1] == '\n' {
		p = p[:n-1]
	}

	l.logs[l.index] = string(p)
	l.index = (l.index + 1) % len(l.logs)

	for lh := range l.handlers {
		lh.HandleLog(string(p))
	}
	return
}
693582
func (ctx *context) WriteWithExpiration(body []byte, modtime time.Time) (int, error) {
	if modified, err := ctx.CheckIfModifiedSince(modtime); !modified && err == nil {
		ctx.WriteNotModified()
		return 0, nil
	}

	ctx.SetLastModified(modtime)
	return ctx.writer.Write(body)
}
89342
func (il IfLogger) With(values ...interface{}) ContextLogger {
	if len(values) == 1 {
		return &contextLogger{isTrue: il.ok(), data: values[0]}
	}
	return &contextLogger{isTrue: il.ok(), data: values}
}
762158
func With(values ...interface{}) ContextLogger {
	if len(values) == 1 {
		return &contextLogger{isTrue: true, data: values[0]}
	}
	return &contextLogger{isTrue: true, data: values}
}
1180128
func (l *withLogger) LogWith(level Level, calldepth int, data []byte, format string, args ...interface{}) {
	if l.GetLevel() >= level {
		l.output(level, calldepth, data, format, args...)
	}
}
831258
func (a *Account) WithLogger(logger log.Interface) *Account {
	a.ctx = logger
	return a
}
901515
func (l *LogFile) Write(b []byte) (int, error) {
	l.Lock()
	defer l.Unlock()
	return l.writer.Write(b)
}