Documentation
¶
Index ¶
- Constants
- type EmptyLog
- func (l *EmptyLog) Debugf(format string, args ...interface{})
- func (l *EmptyLog) Errorf(format string, args ...interface{})
- func (l *EmptyLog) Infof(format string, args ...interface{})
- func (l *EmptyLog) Printf(format string, args ...interface{})
- func (l *EmptyLog) Warnf(format string, args ...interface{})
- type Level
- type Log
- type Logger
- type Middleware
Constants ¶
const TracePrefix = "[TRACE] "
TracePrefix is the prefix used to print a Terraform trace entry log
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EmptyLog ¶
type EmptyLog struct{}
EmptyLog is an implementation of a Logger that do nothing. It's simmilar to Discard.
type Level ¶
type Level uint8
Level is the log level type
const ( LogLevelError Level = iota LogLevelWarn LogLevelInfo LogLevelDebug LogLevelTrace DefLogLevel = LogLevelInfo )
Different log level from higher to lower. Lower log levels to the level set won't be displayed. i.e. If LogLevelWarn is set only Warnings and Errors are displayed. DefLogLevel defines the log level to assing by default
type Log ¶
Log is a basic implementation of the Logger interface that wraps the Go log package and implements Debugf
func DiscardLog ¶
func DiscardLog() *Log
DiscardLog returns a Terranova logger which will discard all the terraform logs.
type Logger ¶
type Logger interface { Printf(format string, args ...interface{}) Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
Logger interface defines the behaviour of a log instance. Every logger requires to implement these methods to be used by the Middleware
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware implementations io.Writer to capture all the Terraform logs using the "log" package and send them to the defined logger
func NewMiddleware ¶
func NewMiddleware(l ...Logger) *Middleware
NewMiddleware creates a new instance of Middleware with the Standard Logger (if nil) a the given logger
func (*Middleware) Close ¶
func (m *Middleware) Close()
Close restore the output of the standard logger (used by Terraform) and stop using the Middleware
func (*Middleware) IsEnabled ¶
func (m *Middleware) IsEnabled() bool
IsEnabled returns true if the Middleware is intercepting the log output or not
func (*Middleware) SetLogger ¶
func (m *Middleware) SetLogger(l Logger)
SetLogger sets or changes the logger of the Middleware, which is the logger to send the Terraform output
func (*Middleware) Start ¶
func (m *Middleware) Start()
Start make the Middleware starts intercepting the log output and sending the log entries to the defined logger