Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FmtLogger ¶
type FmtLogger struct{}
func (*FmtLogger) ErrorWithContext ¶
ErrorWithContext logs at the ERROR log level including additional context so users can easily identify issues.
type Logger ¶
type Logger interface { // Debug logs at the DEBUG log level Debug(message string) // Error logs at the ERROR log level Error(message string) // ErrorWithContext logs at the ERROR log level including additional context so // users can easily identify issues. ErrorWithContext(err error, sub string, ctx ...string) // Info logs at the INFO log level Info(message string) // Trace logs at the TRACE log level Trace(message string) // Warning logs at the WARN log level Warning(message string) }
Logger is the primary interface for logging with a consistent interface without creating a hard dependency between the UI layer and lower layers of the stack. It is inspired a subset of the functions defined by terminal.UI which are generic enough for lower level packages to consume. It expected that implementations of this interface will respect the NOMAD_PACK_LOG_LEVEL environment variable.
type TestLogger ¶
type TestLogger struct {
// contains filtered or unexported fields
}
func NewTestLogger ¶
func NewTestLogger(log func(args ...any)) *TestLogger
NewTestLogger returns a test logger suitable for use with the go testing.T log function.
func (*TestLogger) Debug ¶
func (l *TestLogger) Debug(message string)
Debug logs at the DEBUG log level
func (*TestLogger) Error ¶
func (l *TestLogger) Error(message string)
Error logs at the ERROR log level
func (*TestLogger) ErrorWithContext ¶
func (l *TestLogger) ErrorWithContext(err error, sub string, ctx ...string)
ErrorWithContext logs at the ERROR log level including additional context so users can easily identify issues.
func (*TestLogger) Trace ¶
func (l *TestLogger) Trace(message string)
Trace logs at the TRACE log level
func (*TestLogger) Warning ¶
func (l *TestLogger) Warning(message string)
Warning logs at the WARN log level