github.com/tickstep/library-go@v0.1.1/logger/utils.go (about)

     1  package logger
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/tickstep/library-go/time"
     6  	"io"
     7  	"io/ioutil"
     8  )
     9  
    10  //PrintReader 输出Reader
    11  func PrintReader(r io.Reader) {
    12  	b, _ := ioutil.ReadAll(r)
    13  	fmt.Printf("%s\n", b)
    14  }
    15  
    16  // PrintArgs 输出字符串数组
    17  func PrintArgs(w io.Writer, args ...string) {
    18  	for k, arg := range args {
    19  		io.WriteString(w, fmt.Sprintf("args[%d] = `%s`, ", k, arg))
    20  	}
    21  	w.Write([]byte{'\n'})
    22  }
    23  
    24  func TimePrefix() string {
    25  	return "[" + time.BeijingTimeOption("Refer") + "]"
    26  }