log

package
v2.27.0-RC3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package log contains a re-targetable context-aware logging system. Notably, it allows Beam runners to transparently provide appropriate logging context -- such as DoFn or bundle information -- for user code logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, v ...interface{})

Debug writes the fmt.Sprint-formatted arguments to the global logger with debug severity.

func Debugf

func Debugf(ctx context.Context, format string, v ...interface{})

Debugf writes the fmt.Sprintf-formatted arguments to the global logger with debug severity.

func Debugln

func Debugln(ctx context.Context, v ...interface{})

Debugln writes the fmt.Sprintln-formatted arguments to the global logger with debug severity.

func Error

func Error(ctx context.Context, v ...interface{})

Error writes the fmt.Sprint-formatted arguments to the global logger with error severity.

func Errorf

func Errorf(ctx context.Context, format string, v ...interface{})

Errorf writes the fmt.Sprintf-formatted arguments to the global logger with error severity.

func Errorln

func Errorln(ctx context.Context, v ...interface{})

Errorln writes the fmt.Sprintln-formatted arguments to the global logger with error severity.

func Exit

func Exit(ctx context.Context, v ...interface{})

Exit writes the fmt.Sprint-formatted arguments to the global logger with fatal severity. It then exits.

func Exitf

func Exitf(ctx context.Context, format string, v ...interface{})

Exitf writes the fmt.Sprintf-formatted arguments to the global logger with fatal severity. It then exits.

func Exitln

func Exitln(ctx context.Context, v ...interface{})

Exitln writes the fmt.Sprintln-formatted arguments to the global logger with fatal severity. It then exits.

func Fatal

func Fatal(ctx context.Context, v ...interface{})

Fatal writes the fmt.Sprint-formatted arguments to the global logger with fatal severity. It then panics.

func Fatalf

func Fatalf(ctx context.Context, format string, v ...interface{})

Fatalf writes the fmt.Sprintf-formatted arguments to the global logger with fatal severity. It then panics.

func Fatalln

func Fatalln(ctx context.Context, v ...interface{})

Fatalln writes the fmt.Sprintln-formatted arguments to the global logger with fatal severity. It then panics.

func Info

func Info(ctx context.Context, v ...interface{})

Info writes the fmt.Sprint-formatted arguments to the global logger with info severity.

func Infof

func Infof(ctx context.Context, format string, v ...interface{})

Infof writes the fmt.Sprintf-formatted arguments to the global logger with info severity.

func Infoln

func Infoln(ctx context.Context, v ...interface{})

Infoln writes the fmt.Sprintln-formatted arguments to the global logger with info severity.

func Output

func Output(ctx context.Context, sev Severity, calldepth int, msg string)

Output logs the given message to the global logger. Calldepth is the count of the number of frames to skip when computing the file name and line number.

func SetLogger

func SetLogger(l Logger)

SetLogger sets the global Logger. Intended to be called during initialization only.

func Warn

func Warn(ctx context.Context, v ...interface{})

Warn writes the fmt.Sprint-formatted arguments to the global logger with warn severity.

func Warnf

func Warnf(ctx context.Context, format string, v ...interface{})

Warnf writes the fmt.Sprintf-formatted arguments to the global logger with warn severity.

func Warnln

func Warnln(ctx context.Context, v ...interface{})

Warnln writes the fmt.Sprintln-formatted arguments to the global logger with warn severity.

Types

type Logger

type Logger interface {
	// Log logs the message in some implementation-dependent way. Log should
	// always return regardless of the severity.
	Log(ctx context.Context, sev Severity, calldepth int, msg string)
}

Logger is a context-aware logging backend. The richer context allows for more sophisticated logging setups. Must be concurrency safe.

type Severity

type Severity int

Severity is the severity of the log message.

const (
	SevUnspecified Severity = iota
	SevDebug
	SevInfo
	SevWarn
	SevError
	SevFatal
)

type Standard

type Standard struct {
	// Level is the severity cutoff for log messages. By default all
	// messages are logged.
	Level Severity
}

Standard is a wrapper over the standard Go logger.

func (*Standard) Log

func (s *Standard) Log(ctx context.Context, sev Severity, calldepth int, msg string)

Log logs the message to the standard Go logger. For Panic, it does not perform the os.Exit(1) call, but defers to the log wrapper.

Jump to

Keyboard shortcuts

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