github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/trace/writer_printer.go (about)

     1  package trace
     2  
     3  import (
     4  	"io"
     5  	"log"
     6  )
     7  
     8  type LoggerPrinter struct {
     9  	logger          *log.Logger
    10  	writesToConsole bool
    11  }
    12  
    13  func NewWriterPrinter(writer io.Writer, writesToConsole bool) Printer {
    14  	return &LoggerPrinter{
    15  		logger:          log.New(writer, "", 0),
    16  		writesToConsole: writesToConsole,
    17  	}
    18  }
    19  
    20  func (p *LoggerPrinter) Print(v ...interface{}) {
    21  	p.logger.Print(v...)
    22  }
    23  
    24  func (p *LoggerPrinter) Printf(format string, v ...interface{}) {
    25  	p.logger.Printf(format, v...)
    26  }
    27  
    28  func (p *LoggerPrinter) Println(v ...interface{}) {
    29  	p.logger.Println(v...)
    30  }
    31  
    32  func (p *LoggerPrinter) WritesToConsole() bool {
    33  	return p.writesToConsole
    34  }