logging

package
v0.27.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 316

Documentation

Overview

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Package logging handles logging throughout Atlantis.

Index

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 LogLevel

type LogLevel struct {
	// contains filtered or unexported fields
}

type SimpleLogging added in v0.2.0

type SimpleLogging interface {

	// These basically just fmt.Sprintf() the message and args.
	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{})
	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 ...interface{}) 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 ...interface{}) 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 *testing.T) 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 ...interface{})

func (*StructuredLogger) Err added in v0.17.0

func (l *StructuredLogger) Err(format string, a ...interface{})

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 ...interface{})

func (*StructuredLogger) Log added in v0.17.0

func (l *StructuredLogger) Log(level LogLevel, format string, a ...interface{})

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 ...interface{})

func (*StructuredLogger) With added in v0.17.0

func (l *StructuredLogger) With(a ...interface{}) SimpleLogging

func (*StructuredLogger) WithHistory added in v0.17.0

func (l *StructuredLogger) WithHistory(a ...interface{}) SimpleLogging

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL