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 ¶
- Variables
- func Debug(ctx context.Context, v ...any)
- func Debugf(ctx context.Context, format string, v ...any)
- func Debugln(ctx context.Context, v ...any)
- func Error(ctx context.Context, v ...any)
- func Errorf(ctx context.Context, format string, v ...any)
- func Errorln(ctx context.Context, v ...any)
- func Exit(ctx context.Context, v ...any)
- func Exitf(ctx context.Context, format string, v ...any)
- func Exitln(ctx context.Context, v ...any)
- func Fatal(ctx context.Context, v ...any)
- func Fatalf(ctx context.Context, format string, v ...any)
- func Fatalln(ctx context.Context, v ...any)
- func Info(ctx context.Context, v ...any)
- func Infof(ctx context.Context, format string, v ...any)
- func Infoln(ctx context.Context, v ...any)
- func Output(ctx context.Context, sev Severity, calldepth int, msg string)
- func SetLogger(l Logger)
- func SetupLogging(logLevel, logKind string)
- func SetupLoggingWithDefault()
- func Warn(ctx context.Context, v ...any)
- func Warnf(ctx context.Context, format string, v ...any)
- func Warnln(ctx context.Context, v ...any)
- type Logger
- type Severity
- type Standard
- type Structural
Constants ¶
This section is empty.
Variables ¶
var ( LogLevel = "info" // The logging level for slog. Valid values are `debug`, `info`, `warn` or `error`. Default is `info`. LogKind = "text" // The logging format for slog. Valid values are `dev', 'json', or 'text'. Default is `text`. )
Functions ¶
func Debug ¶
Debug writes the fmt.Sprint-formatted arguments to the global logger with debug severity.
func Debugf ¶
Debugf writes the fmt.Sprintf-formatted arguments to the global logger with debug severity.
func Debugln ¶
Debugln writes the fmt.Sprintln-formatted arguments to the global logger with debug severity.
func Error ¶
Error writes the fmt.Sprint-formatted arguments to the global logger with error severity.
func Errorf ¶
Errorf writes the fmt.Sprintf-formatted arguments to the global logger with error severity.
func Errorln ¶
Errorln writes the fmt.Sprintln-formatted arguments to the global logger with error severity.
func Exit ¶
Exit writes the fmt.Sprint-formatted arguments to the global logger with fatal severity. It then exits.
func Exitf ¶
Exitf writes the fmt.Sprintf-formatted arguments to the global logger with fatal severity. It then exits.
func Exitln ¶
Exitln writes the fmt.Sprintln-formatted arguments to the global logger with fatal severity. It then exits.
func Fatal ¶
Fatal writes the fmt.Sprint-formatted arguments to the global logger with fatal severity. It then panics.
func Fatalf ¶
Fatalf writes the fmt.Sprintf-formatted arguments to the global logger with fatal severity. It then panics.
func Fatalln ¶
Fatalln writes the fmt.Sprintln-formatted arguments to the global logger with fatal severity. It then panics.
func Infof ¶
Infof writes the fmt.Sprintf-formatted arguments to the global logger with info severity.
func Infoln ¶
Infoln writes the fmt.Sprintln-formatted arguments to the global logger with info severity.
func Output ¶
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 SetupLogging ¶ added in v2.69.0
func SetupLogging(logLevel, logKind string)
func SetupLoggingWithDefault ¶ added in v2.69.0
func SetupLoggingWithDefault()
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 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.