github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/testing/iotest/logger.go (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package iotest
     6  
     7  import (
     8  	"github.com/shogo82148/std/io"
     9  )
    10  
    11  // NewWriteLoggerは、wのように振る舞うライターを返しますが、
    12  // 書き込みごとに([log.Printf] を使用して)標準エラーにログを出力し、
    13  // プレフィックスと書き込まれた16進数データを印刷します。
    14  func NewWriteLogger(prefix string, w io.Writer) io.Writer
    15  
    16  // NewReadLoggerは、rと同様に動作するリーダーを返しますが、
    17  // 読み取りごとに([log.Printf] を使用して)標準エラーにログを出力し、
    18  // プレフィックスと読み取った16進数データを印刷します。
    19  func NewReadLogger(prefix string, r io.Reader) io.Reader