// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package iotest

import (
	
	
)

type writeLogger struct {
	prefix string
	w      io.Writer
}

func ( *writeLogger) ( []byte) ( int,  error) {
	,  = .w.Write()
	if  != nil {
		log.Printf("%s %x: %v", .prefix, [0:], )
	} else {
		log.Printf("%s %x", .prefix, [0:])
	}
	return
}

// NewWriteLogger returns a writer that behaves like w except
// that it logs (using [log.Printf]) each write to standard error,
// printing the prefix and the hexadecimal data written.
func ( string,  io.Writer) io.Writer {
	return &writeLogger{, }
}

type readLogger struct {
	prefix string
	r      io.Reader
}

func ( *readLogger) ( []byte) ( int,  error) {
	,  = .r.Read()
	if  != nil {
		log.Printf("%s %x: %v", .prefix, [0:], )
	} else {
		log.Printf("%s %x", .prefix, [0:])
	}
	return
}

// NewReadLogger returns a reader that behaves like r except
// that it logs (using [log.Printf]) each read to standard error,
// printing the prefix and the hexadecimal data read.
func ( string,  io.Reader) io.Reader {
	return &readLogger{, }
}