logger

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Package logger provides interfaces and implementations for routing stdout/stderr output from runtime CLI commands to the user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogger

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

WithLogger returns a new context with the logger attached.

Types

type Logger

type Logger interface {
	// Stdout returns the writer for standard output from runtime commands.
	Stdout() io.Writer

	// Stderr returns the writer for standard error from runtime commands.
	Stderr() io.Writer
}

Logger provides writers for routing stdout and stderr of runtime CLI commands.

func FromContext

func FromContext(ctx context.Context) Logger

FromContext retrieves the logger from context. Returns a NoOpLogger if no logger is in context.

func NewNoOpLogger

func NewNoOpLogger() Logger

NewNoOpLogger creates a new no-op logger.

func NewTextLogger

func NewTextLogger(stdout, stderr io.Writer) Logger

NewTextLogger creates a new logger that writes to the given stdout and stderr writers. If either writer is nil, it defaults to io.Discard.

Jump to

Keyboard shortcuts

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