Documentation
¶
Overview ¶
Copyright 2017 HootSuite Media Inc. SPDX-License-Identifier: Apache-2.0 Modified hereafter by contributors to runatlantis/atlantis.
Package logging handles logging throughout Atlantis.
Index ¶
- Variables
- func SuppressDefaultLogging()
- type LogLevel
- type SimpleLogging
- type StructuredLogger
- func (l *StructuredLogger) Debug(format string, a ...any)
- func (l *StructuredLogger) Err(format string, a ...any)
- func (l *StructuredLogger) Flush() error
- func (l *StructuredLogger) GetHistory() string
- func (l *StructuredLogger) Info(format string, a ...any)
- func (l *StructuredLogger) Log(level LogLevel, format string, a ...any)
- func (l *StructuredLogger) SetLevel(lvl LogLevel)
- func (l *StructuredLogger) Warn(format string, a ...any)
- func (l *StructuredLogger) With(a ...any) SimpleLogging
- func (l *StructuredLogger) WithHistory(a ...any) SimpleLogging
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Debug = LogLevel{ // contains filtered or unexported fields } Info = LogLevel{ // contains filtered or unexported fields } Warn = LogLevel{ // contains filtered or unexported fields } Error = LogLevel{ // contains filtered or unexported fields } )
Functions ¶
func SuppressDefaultLogging ¶ added in v0.23.0
func SuppressDefaultLogging()
SuppressDefaultLogging suppresses the default logging
Types ¶
type SimpleLogging ¶ added in v0.2.0
type SimpleLogging interface {
// These basically just fmt.Sprintf() the message and args.
Debug(format string, a ...any)
Info(format string, a ...any)
Warn(format string, a ...any)
Err(format string, a ...any)
Log(level LogLevel, format string, a ...any)
SetLevel(lvl LogLevel)
// With adds a variadic number of fields to the logging context. It accepts a
// mix of strongly-typed Field objects and loosely-typed key-value pairs. When
// processing pairs, the first element of the pair is used as the field key
// and the second as the field value.
With(a ...any) SimpleLogging
// Creates a new logger with history preserved . log storage + search strategies
// should ideally be used instead of managing this ourselves.
// keeping as a separate method to ensure that usage of history is completely intentional
WithHistory(a ...any) SimpleLogging
// Fetches the history we've stored associated with the logging context
GetHistory() string
// Flushes anything left in the buffer
Flush() error
}
SimpleLogging is the interface used for logging throughout the codebase.
func NewNoopLogger ¶
func NewNoopLogger(t zaptest.TestingT) SimpleLogging
NewNoopLogger creates a logger instance that discards all logs and never writes them. Used for testing.
func NewStructuredLogger ¶ added in v0.17.0
func NewStructuredLogger() (SimpleLogging, error)
func NewStructuredLoggerFromLevel ¶ added in v0.17.0
func NewStructuredLoggerFromLevel(lvl LogLevel) (SimpleLogging, error)
type StructuredLogger ¶ added in v0.17.0
type StructuredLogger struct {
// contains filtered or unexported fields
}
func (*StructuredLogger) Debug ¶ added in v0.17.0
func (l *StructuredLogger) Debug(format string, a ...any)
func (*StructuredLogger) Err ¶ added in v0.17.0
func (l *StructuredLogger) Err(format string, a ...any)
func (*StructuredLogger) Flush ¶ added in v0.17.0
func (l *StructuredLogger) Flush() error
func (*StructuredLogger) GetHistory ¶ added in v0.17.0
func (l *StructuredLogger) GetHistory() string
func (*StructuredLogger) Info ¶ added in v0.17.0
func (l *StructuredLogger) Info(format string, a ...any)
func (*StructuredLogger) Log ¶ added in v0.17.0
func (l *StructuredLogger) Log(level LogLevel, format string, a ...any)
func (*StructuredLogger) SetLevel ¶ added in v0.17.0
func (l *StructuredLogger) SetLevel(lvl LogLevel)
func (*StructuredLogger) Warn ¶ added in v0.17.0
func (l *StructuredLogger) Warn(format string, a ...any)
func (*StructuredLogger) With ¶ added in v0.17.0
func (l *StructuredLogger) With(a ...any) SimpleLogging
func (*StructuredLogger) WithHistory ¶ added in v0.17.0
func (l *StructuredLogger) WithHistory(a ...any) SimpleLogging
Click to show internal directories.
Click to hide internal directories.