hclogadapter

package
v0.0.0-...-545971b Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2022 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger describes the interface that must be implemeted by all loggers.

func New

func New(name string, logger ambient.AppLogger) *Logger

New returns a new Ambient logger for plugins.

func (*Logger) Debug

func (l *Logger) Debug(msg string, args ...interface{})

Debug emits a message and key/value pairs at the DEBUG level.

func (*Logger) Error

func (l *Logger) Error(msg string, args ...interface{})

Error emits a message and key/value pairs at the ERROR level.

func (*Logger) ImpliedArgs

func (l *Logger) ImpliedArgs() []interface{}

ImpliedArgs returns With key/value pairs.

func (*Logger) Info

func (l *Logger) Info(msg string, args ...interface{})

Info emits a message and key/value pairs at the INFO level.

func (*Logger) IsDebug

func (l *Logger) IsDebug() bool

IsDebug indicates if DEBUG logs would be emitted. This and the other Is* guards.

func (*Logger) IsError

func (l *Logger) IsError() bool

IsError indicates if ERROR logs would be emitted. This and the other Is* guards.

func (*Logger) IsInfo

func (l *Logger) IsInfo() bool

IsInfo indicates if INFO logs would be emitted. This and the other Is* guards.

func (*Logger) IsTrace

func (l *Logger) IsTrace() bool

IsTrace indicates if TRACE logs would be emitted. This and the other Is* guards are used to elide expensive logging code based on the current level.

func (*Logger) IsWarn

func (l *Logger) IsWarn() bool

IsWarn indicates if WARN logs would be emitted. This and the other Is* guards.

func (*Logger) Log

func (l *Logger) Log(level hclog.Level, msg string, args ...interface{})

Log sends a message to the logger. Args are alternating key, val pairs. keys must be strings. vals can be any type, but display is implementation specific. Emit a message and key/value pairs at a provided log level.

func (*Logger) Name

func (l *Logger) Name() string

Name returns the Name of the logger.

func (*Logger) Named

func (l *Logger) Named(name string) hclog.Logger

Named creates a logger that will prepend the name string on the front of all messages. If the logger already has a name, the new value will be appended to the current name. That way, a major subsystem can use this to decorate all it's own logs without losing context.

func (*Logger) ResetNamed

func (l *Logger) ResetNamed(name string) hclog.Logger

ResetNamed creates a logger that will prepend the name string on the front of all messages. This sets the name of the logger to the value directly, unlike Named which honor the current name as well.

func (*Logger) SetLevel

func (l *Logger) SetLevel(level hclog.Level)

SetLevel updates the level. This should affect all related loggers as well, unless they were created with IndependentLevels. If an implementation cannot update the level on the fly, it should no-op.

func (*Logger) StandardLogger

func (l *Logger) StandardLogger(opts *hclog.StandardLoggerOptions) *log.Logger

StandardLogger returns a value that conforms to the stdlib log.Logger interface.

func (*Logger) StandardWriter

func (l *Logger) StandardWriter(opts *hclog.StandardLoggerOptions) io.Writer

StandardWriter returns a value that conforms to io.Writer, which can be passed into log.SetOutput().

func (*Logger) Trace

func (l *Logger) Trace(msg string, args ...interface{})

Trace emits a message and key/value pairs at the TRACE level.

func (*Logger) Warn

func (l *Logger) Warn(msg string, args ...interface{})

Warn emits a message and key/value pairs at the WARN level.

func (*Logger) With

func (l *Logger) With(args ...interface{}) hclog.Logger

With creates a sublogger that will always have the given key/value pairs.

Jump to

Keyboard shortcuts

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