// Return a value that conforms to io.Writer, which can be passed into log.SetOutput()
973250
func (lw LogWrapper) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer {
	return ioutil.Discard
}
90545
func (lw LoggerWriter) Write(p []byte) (n int, err error) {
	if len(p) == 0 {
		return 0, nil
	}
	lw.logger.Printf("%v", string(p))
	return len(p), nil
}
223644
func (s *WriterSender) Write(p []byte) (int, error) {
	s.mu.Lock()
	defer s.mu.Unlock()
	n, err := s.writer.Write(p)
	if err != nil {
		return n, err
	}
	_ = s.writer.Flush()

	if s.buffer.Len() > 80 {
		err = s.doSend()
	}

	return n, err
}
919151
func (log logReferrer) Write(message []byte) (int, error) {
	length := len(message)
	if length == 0 {
		return 0, nil
	}

	logMessage := bytes.TrimRight(message, "\r\n\t ")
	switch {
	case log.writer == nil:
		fmt.Println(string(logMessage))
		return length, nil

	case log.writer == os.Stdout || log.writer == os.Stderr:
		fmt.Fprintln(log.writer, string(logMessage))
		return length, nil

	default:
		return log.writer.Write(logMessage)
	}
}
624109
func (w *Writer) Write(b []byte) (int, error) {
	n := len(b)
	end := len(w.buf)
	if end+n > cap(w.buf) {
		buf := make([]byte, end, 2*cap(w.buf)+n)
		copy(buf, w.buf)
		w.buf = buf
	}
	w.buf = w.buf[:end+n]
	return copy(w.buf[end:], b), nil
}
842770
func (l *Listener) SetWriteBuffer(bytes int) error {
	if nc, ok := l.conn.(setWriteBuffer); ok {
		return nc.SetWriteBuffer(bytes)
	}
	return errors.New(errInvalidOperation)
}
28412
func (w *logWriter) write(msg *logMessage) error {
	if msg.timestamp.Before(w.opts.since) {
		// Skip the line because it's older than since
		return nil
	}
	line := msg.log
	if w.opts.timestamp {
		prefix := append([]byte(msg.timestamp.Format(timeFormat)), delimiter[0])
		line = append(prefix, line...)
	}
	// If the line is longer than the remaining bytes, cut it.
	if int64(len(line)) > w.remain {
		line = line[:w.remain]
	}
	// Get the proper stream to write to.
	var stream io.Writer
	switch msg.stream {
	case runtimeapi.Stdout:
		stream = w.stdout
	case runtimeapi.Stderr:
		stream = w.stderr
	default:
		return fmt.Errorf("unexpected stream type %q", msg.stream)
	}
	n, err := stream.Write(line)
	w.remain -= int64(n)
	if err != nil {
		return err
	}
	// If the line has not been fully written, return errShortWrite
	if n < len(line) {
		return errShortWrite
	}
	// If there are no more bytes left, return errMaximumWrite
	if w.remain <= 0 {
		return errMaximumWrite
	}
	return nil
}
37858
func (l *logger) Write(p []byte) (n int, err error) {
	l.locker.Lock()
	for _, w := range l.writers {
		n, err = w.Output().Write(p)
		if err != nil {
			return
		}
	}
	l.locker.Unlock()
	return
}
524383
func (w *LogWriter) Write(b []byte) (int, error) {
	return len(b), nil
}
463352
func (w *LoggoWriter) Write(p []byte) (int, error) {
	w.Logger.Logf(w.Level, "%s", p[:len(p)-1]) // omit trailing newline
	return len(p), nil
}
546204
func (bw *Writer) WriteValue(v wire.Value) error {
	switch v.Type() {
	case wire.TBool:
		if v.GetBool() {
			return bw.writeByte(1)
		}
		return bw.writeByte(0)

	case wire.TI8:
		return bw.writeByte(byte(v.GetI8()))

	case wire.TDouble:
		value := math.Float64bits(v.GetDouble())
		return bw.writeInt64(int64(value))

	case wire.TI16:
		return bw.writeInt16(v.GetI16())

	case wire.TI32:
		return bw.writeInt32(v.GetI32())

	case wire.TI64:
		return bw.writeInt64(v.GetI64())

	case wire.TBinary:
		b := v.GetBinary()
		if err := bw.writeInt32(int32(len(b))); err != nil {
			return err
		}
		return bw.write(b)

	case wire.TStruct:
		return bw.writeStruct(v.GetStruct())

	case wire.TMap:
		return bw.writeMap(v.GetMap())

	case wire.TSet:
		return bw.writeSet(v.GetSet())

	case wire.TList:
		return bw.writeList(v.GetList())

	default:
		return fmt.Errorf("unknown ttype %v", v.Type())
	}
}
177616
func Writer(w io.Writer) (io.Writer, func()) {
	var out = os.Stderr
	if f, ok := w.(*os.File); ok && f == os.Stderr {
		out = os.Stdout
	}
	sprk := Spark(time.Millisecond * 33)
	sprk.Units = Bytes
	sprk.Out = out
	started := false
	return writer(func(b []byte) (int, error) {
		if !started {
			sprk.Start()
			started = true
		}
		n, err := w.Write(b)
		if err == nil {
			sprk.Add(float64(n))
		} else {
			sprk.Stop()
		}
		return n, err
	}), sprk.Stop
}
987697
func (lrw *loggingResponseWriter) Write(buf []byte) (int, error) {
	goa.LogInfo(lrw.ctx, "response", "body", string(buf))
	return lrw.ResponseWriter.Write(buf)
}
1272806
func (ml *MockRouteCountLogger) SetOutput(output io.Writer) {
	ml.logger.SetOutput(output)
}
901515
func (l *LogFile) Write(b []byte) (int, error) {
	l.Lock()
	defer l.Unlock()
	return l.writer.Write(b)
}
1248893
func SetOutput(lo Logger, ou io.Writer) error {
	return list.SetOutput(lo, ou)
}
649749
func (s *Logging) Write(b []byte) (int, error) {
	s.mutex.RLock()
	w := s.writer
	s.mutex.RUnlock()

	return w.Write(b)
}