log

package
v3.0.0-...-7ba4d6b Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 5 Imported by: 57

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 ...any)

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

func Debugf

func Debugf(ctx context.Context, format string, v ...any)

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

func Debugln

func Debugln(ctx context.Context, v ...any)

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

func Error

func Error(ctx context.Context, v ...any)

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

func Errorf

func Errorf(ctx context.Context, format string, v ...any)

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

func Errorln

func Errorln(ctx context.Context, v ...any)

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

func Exit

func Exit(ctx context.Context, v ...any)

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 ...any)

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 ...any)

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 ...any)

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 ...any)

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 ...any)

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 ...any)

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

func Infof

func Infof(ctx context.Context, format string, v ...any)

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

func Infoln

func Infoln(ctx context.Context, v ...any)

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 ...any)

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

func Warnf

func Warnf(ctx context.Context, format string, v ...any)

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

func Warnln

func Warnln(ctx context.Context, v ...any)

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