// Dump dumps the current memory logger contents to the given writer in a
// human-readable format.
969051
func (m *MemLogger) Dump(w io.Writer) (n int, err error) {
	amt := 0
	for i, msg := range m.Messages() {
		if i == 0 {
			amt, err = fmt.Fprintf(w, "\nDUMP LOG:\n")
			n += amt
			if err != nil {
				return
			}
		}
		if msg.Data == nil {
			amt, err = fmt.Fprintf(w, "  %s: %s\n", msg.Level, msg.Msg)
			n += amt
			if err != nil {
				return
			}
		} else {
			amt, err = fmt.Fprintf(w, "  %s: %s: %s\n", msg.Level, msg.Msg, logging.Fields(msg.Data))
			n += amt
			if err != nil {
				return
			}
		}
	}
	return
}
876272
func (e *Env) Dump() {
	e.RLock()
	fmt.Printf("Name: %v\n", e.name)
	fmt.Printf("Has parent: %v\n", e.parent != nil)
	for k, v := range e.env {
		fmt.Printf("%v = %#v\n", k, v)
	}
	e.RUnlock()
}
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
}
613934
func (l *Logger) Writer(severity int) io.Writer {
	logfunc := func(p []byte) (n int, err error) {
		for len(p) > 0 {
			eol := bytes.IndexByte(p, '\n')
			if eol == -1 {
				return
			}
			ln := eol + 1
			err = l.Log(severity, string(p[:eol]), nil)
			if err != nil {
				return
			}
			n += ln
			p = p[ln:]
		}
		return
	}

	return &logWriter{
		buf:     make([]byte, 0, maxLogSize/2),
		logfunc: logfunc,
	}
}
1105770
func (l Logger) Output(w io.Writer) Logger {
	l2 := New(w)
	l2.level = l.level
	l2.sampler = l.sampler
	if len(l.hooks) > 0 {
		l2.hooks = append(l2.hooks, l.hooks...)
	}
	if l.context != nil {
		l2.context = make([]byte, len(l.context), cap(l.context))
		copy(l2.context, l.context)
	}
	return l2
}
1352915
func Dump(m interface{}, args ...bool) (r string) {
	v, err := json.MarshalIndent(m, "", "  ")
	if err != nil {
		fmt.Printf("%v\n", err)
	}
	r = string(v)
	l := len(args)
	if l < 1 || args[0] {
		fmt.Println(r)
	}
	return
}
190339
func Output(out io.Writer) Option {
	return func(l *handler) {
		l.out = out
	}
}
1299105
func (w *LogWriter) Write(p []byte) (int, error) {
	w.bufferLock.Lock()
	defer w.bufferLock.Unlock()

	w.buffer = append(w.buffer, p...)

	for len(w.buffer) > w.maxChunkSize {
		chunk := w.buffer[:w.maxChunkSize]
		w.buffer = w.buffer[w.maxChunkSize:]
		w.send(chunk)
	}

	return len(p), nil
}
754835
func Dump(data []byte) string {
	var buf bytes.Buffer
	dumper := Dumper(&buf)
	dumper.Write(data)
	dumper.Close()
	return buf.String()
}
746252
func (writer GlogWriter) Write(data []byte) (n int, err error) {
	glog.Info(string(data))
	return len(data), nil
}
584693
func (k TupleKey4) Dump(buffer *bytes.Buffer, reverse bool) bool {
	var addrDest string

	if k.NextHeader == 0 {
		return false
	}

	// Addresses swapped, see issue #5848
	if reverse {
		addrDest = k.SourceAddr.IP().String()
	} else {
		addrDest = k.DestAddr.IP().String()
	}

	if k.Flags&TUPLE_F_IN != 0 {
		buffer.WriteString(fmt.Sprintf("%s IN %s %d:%d ",
			k.NextHeader.String(), addrDest, k.SourcePort,
			k.DestPort),
		)
	} else {
		buffer.WriteString(fmt.Sprintf("%s OUT %s %d:%d ",
			k.NextHeader.String(), addrDest, k.DestPort,
			k.SourcePort),
		)
	}

	if k.Flags&TUPLE_F_RELATED != 0 {
		buffer.WriteString("related ")
	}

	if k.Flags&TUPLE_F_SERVICE != 0 {
		buffer.WriteString("service ")
	}

	return true
}
1059984
func (c Config) Dump(buf []byte) string {
	N := c.Width
	var out bytes.Buffer
	rowIndex := 0
	maxRowWidth := 0
	for rowIndex*N < len(buf) {
		a, b := rowIndex*N, (rowIndex+1)*N
		if b > len(buf) {
			b = len(buf)
		}
		row := buf[a:b]
		hex, ascii := printable(row)

		if len(row) < maxRowWidth {
			padding := maxRowWidth*2 + maxRowWidth/4 - len(row)*2 - len(row)/4
			hex += strings.Repeat(" ", padding)
		}
		maxRowWidth = len(row)

		fmt.Fprintf(&out, "%5d: %s | %s\n", a, hex, ascii)
		rowIndex++
	}
	return out.String()
}
410452
func (rb *RingBuf) Dump() []byte {
	dump := make([]byte, len(rb.data))
	copy(dump, rb.data)
	return dump
}
677133
func (o testOutput) Write(p []byte) (int, error) {
	msg := strings.TrimSpace(string(p))
	o.Log(msg)
	return len(p), nil
}
91899
func (p *PreFilter) Dump(to []string) ([]string, int64) {
	p.mutex.RLock()
	defer p.mutex.RUnlock()
	for i := prefixesV4Dyn; i < mapCount; i++ {
		to = p.dumpOneMap(i, to)
	}
	return to, p.revision
}
570259
func (log *logCache) Write(message []byte) (int, error) {
	log.flushing.Lock()
	defer log.flushing.Unlock()

	if len(message) > 0 {
		messageCopy := make([]byte, len(message))
		copy(messageCopy, message)
		log.messages = append(log.messages, messageCopy)
	}
	return len(message), nil
}
794082
func (sc *SigChain) Dump(w io.Writer) {
	fmt.Fprintf(w, "sigchain dump\n")
	for i, l := range sc.chainLinks {
		fmt.Fprintf(w, "link %d: %+v\n", i, l)
	}
	fmt.Fprintf(w, "last known seqno: %d\n", sc.GetLastKnownSeqno())
	fmt.Fprintf(w, "last known id: %s\n", sc.GetLastKnownID())
}