github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/helper/logging/logging.go (about)

     1  package logging
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/go-hclog"
     7  )
     8  
     9  // HcLogUI is an implementation of Ui that takes a hclogger
    10  // and uses it to Log the output. It is intended for write only
    11  // use cases and the Ask/AskSecret methods are not implemented.
    12  type HcLogUI struct {
    13  	Log hclog.Logger
    14  }
    15  
    16  func (l *HcLogUI) Ask(query string) (string, error) {
    17  	return "", fmt.Errorf("Ask is not supported in this implementation")
    18  }
    19  
    20  func (l *HcLogUI) AskSecret(query string) (string, error) {
    21  	return "", fmt.Errorf("AskSecret is not supported in this implementation")
    22  }
    23  
    24  func (l *HcLogUI) Output(message string) {
    25  	l.Log.Info(message)
    26  }
    27  
    28  func (l *HcLogUI) Info(message string) {
    29  	l.Log.Info(message)
    30  }
    31  
    32  func (l *HcLogUI) Error(message string) {
    33  	l.Log.Error(message)
    34  }
    35  
    36  func (l *HcLogUI) Warn(message string) {
    37  	l.Log.Warn(message)
    38  }