log

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package log provides context-aware logging for wt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogger

func WithLogger(ctx context.Context, l *Logger) context.Context

WithLogger attaches a logger to the context.

Types

type Logger

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

Logger provides output and verbose command logging.

func FromContext

func FromContext(ctx context.Context) *Logger

FromContext retrieves the logger from context. Returns a no-op logger if none is attached.

func New

func New(out io.Writer, verbose, quiet bool) *Logger

New creates a new logger.

func (*Logger) Command

func (l *Logger) Command(name string, args ...string)

Command logs an external command execution. Only prints when verbose mode is enabled and quiet mode is disabled.

func (*Logger) Debug added in v0.13.0

func (l *Logger) Debug(msg string, keyvals ...any)

Debug logs a debug message with key-value pairs. Only prints when verbose mode is enabled and quiet mode is disabled.

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...any)

Printf writes formatted output.

func (*Logger) Println

func (l *Logger) Println(args ...any)

Println writes a line of output.

func (*Logger) Quiet added in v0.10.0

func (l *Logger) Quiet() bool

Quiet returns true if quiet mode is enabled.

func (*Logger) Verbose

func (l *Logger) Verbose() bool

Verbose returns true if verbose mode is enabled.

func (*Logger) Writer

func (l *Logger) Writer() io.Writer

Writer returns the underlying writer.

Jump to

Keyboard shortcuts

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