logger

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(opts InitOptions)

Init initializes the global logger with the provided options. This function is safe to call multiple times - only the first call will initialize the logger. When TestingTB is provided, it initializes a test logger specific to that test.

func Log

func Log() io.Logger

Log returns the global logger instance. The logger must be initialized with Init() before calling this function.

func Reset

func Reset()

Reset resets the global logger to its initial state.

Types

type InitOptions

type InitOptions struct {
	StdOut           *os.File
	ArchiveDirectory string
	LogMode          io.LogMode
	Theme            themes.Theme

	// TestingTB is used to set a testing.T instance for the logger.
	// This is useful for capturing log output in tests.
	TestingTB testing.TB
	Logger    io.Logger // Optional logger to use instead of creating a new one
}

Jump to

Keyboard shortcuts

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