Documentation ¶
Overview ¶
Package logging handles logging throughout Atlantis.
Index ¶
- type LogLevel
- type SimpleLogger
- func (l *SimpleLogger) Debug(format string, a ...interface{})
- func (l *SimpleLogger) Err(format string, a ...interface{})
- func (l *SimpleLogger) GetLevel() LogLevel
- func (l *SimpleLogger) Info(format string, a ...interface{})
- func (l *SimpleLogger) Log(level LogLevel, format string, a ...interface{})
- func (l *SimpleLogger) Underlying() *log.Logger
- func (l *SimpleLogger) Warn(format string, a ...interface{})
- type SimpleLogging
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogLevel ¶
type LogLevel int
func ToLogLevel ¶
ToLogLevel converts a log level string to a valid LogLevel object. If the string doesn't match a level, it will return Info.
type SimpleLogger ¶
type SimpleLogger struct { // Source is added as a prefix to each log entry. // It's useful if you want to trace a log entry back to a // context, for example a pull request id. Source string // History stores all log entries ever written using // this logger. This is safe for short-lived loggers // like those used during plan/apply commands. History bytes.Buffer Logger *log.Logger KeepHistory bool Level LogLevel }
SimpleLogger wraps the standard logger with leveled logging and the ability to store log history for later adding it to a VCS comment.
func NewNoopLogger ¶
func NewNoopLogger() *SimpleLogger
NewNoopLogger creates a logger instance that discards all logs and never writes them. Used for testing.
func NewSimpleLogger ¶
func NewSimpleLogger(source string, logger *log.Logger, keepHistory bool, level LogLevel) *SimpleLogger
NewSimpleLogger creates a new logger.
- source is added as a prefix to each log entry. It's useful if you want to trace a log entry back to a context, for example a pull request id.
- logger is the underlying logger. If nil will create a logger from stdlib.
- keepHistory set to true will store all log entries written using this logger.
- level will set the level at which logs >= than that level will be written. If keepHistory is set to true, we'll store logs at all levels, regardless of what level is set to.
func (*SimpleLogger) Debug ¶
func (l *SimpleLogger) Debug(format string, a ...interface{})
func (*SimpleLogger) Err ¶
func (l *SimpleLogger) Err(format string, a ...interface{})
func (*SimpleLogger) GetLevel ¶ added in v0.2.0
func (l *SimpleLogger) GetLevel() LogLevel
func (*SimpleLogger) Info ¶
func (l *SimpleLogger) Info(format string, a ...interface{})
func (*SimpleLogger) Log ¶
func (l *SimpleLogger) Log(level LogLevel, format string, a ...interface{})
func (*SimpleLogger) Underlying ¶ added in v0.2.0
func (l *SimpleLogger) Underlying() *log.Logger
func (*SimpleLogger) Warn ¶
func (l *SimpleLogger) Warn(format string, a ...interface{})
type SimpleLogging ¶ added in v0.2.0
type SimpleLogging interface { Debug(format string, a ...interface{}) Info(format string, a ...interface{}) Warn(format string, a ...interface{}) Err(format string, a ...interface{}) Log(level LogLevel, format string, a ...interface{}) // Underlying returns the underlying logger. Underlying() *log.Logger // GetLevel returns the current log level. GetLevel() LogLevel }
Click to show internal directories.
Click to hide internal directories.