github.com/xiaobinqt/libcompose@v1.1.0/logger/raw_logger.go (about)

     1  package logger
     2  
     3  import (
     4  	"fmt"
     5  	"io"
     6  	"os"
     7  )
     8  
     9  // RawLogger is a logger.Logger and logger.Factory implementation that prints raw data with no formatting.
    10  type RawLogger struct {
    11  }
    12  
    13  // Out is a no-op function.
    14  func (r *RawLogger) Out(message []byte) {
    15  	fmt.Print(string(message))
    16  
    17  }
    18  
    19  // Err is a no-op function.
    20  func (r *RawLogger) Err(message []byte) {
    21  	fmt.Fprint(os.Stderr, string(message))
    22  
    23  }
    24  
    25  // CreateContainerLogger allows RawLogger to implement logger.Factory.
    26  func (r *RawLogger) CreateContainerLogger(_ string) Logger {
    27  	return &RawLogger{}
    28  }
    29  
    30  // CreateBuildLogger allows RawLogger to implement logger.Factory.
    31  func (r *RawLogger) CreateBuildLogger(_ string) Logger {
    32  	return &RawLogger{}
    33  }
    34  
    35  // CreatePullLogger allows RawLogger to implement logger.Factory.
    36  func (r *RawLogger) CreatePullLogger(_ string) Logger {
    37  	return &RawLogger{}
    38  }
    39  
    40  // OutWriter returns the base writer
    41  func (r *RawLogger) OutWriter() io.Writer {
    42  	return os.Stdout
    43  }
    44  
    45  // ErrWriter returns the base writer
    46  func (r *RawLogger) ErrWriter() io.Writer {
    47  	return os.Stderr
    48  }