log

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 1 Imported by: 6

Documentation

Overview

Package log provides logging functionality to notation. Users who want to enable logging option in notation should implement the log.Logger interface and include it in context by calling log.WithLogger. 3rd party loggers that implement log.Logger: github.com/uber-go/zap.SugaredLogger and github.com/sirupsen/logrus.Logger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogger

func WithLogger(ctx context.Context, logger Logger) context.Context

WithLogger is used by callers to set the Logger in the context. It enables logging option in notation.

Types

type Logger

type Logger interface {
	// Debug logs a debug level message.
	Debug(args ...interface{})

	// Debugf logs a debug level message with format.
	Debugf(format string, args ...interface{})

	// Debugln logs a debug level message. Spaces are always added between
	// operands.
	Debugln(args ...interface{})

	// Info logs an info level message.
	Info(args ...interface{})

	// Infof logs an info level message with format.
	Infof(format string, args ...interface{})

	// Infoln logs an info level message. Spaces are always added between
	// operands.
	Infoln(args ...interface{})

	// Warn logs a warn level message.
	Warn(args ...interface{})

	// Warnf logs a warn level message with format.
	Warnf(format string, args ...interface{})

	// Warnln logs a warn level message. Spaces are always added between
	// operands.
	Warnln(args ...interface{})

	// Error logs an error level message.
	Error(args ...interface{})

	// Errorf logs an error level message with format.
	Errorf(format string, args ...interface{})

	// Errorln logs an error level message. Spaces are always added between
	// operands.
	Errorln(args ...interface{})
}

Logger is implemented by users and/or 3rd party loggers. For example, github.com/uber-go/zap.SugaredLogger and github.com/sirupsen/logrus.Logger.

var Discard Logger = &discardLogger{}

Discard is a discardLogger that is used to disenable logging in notation.

func GetLogger

func GetLogger(ctx context.Context) Logger

GetLogger is used to retrieve the Logger from the context.

Jump to

Keyboard shortcuts

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