config

package
v3.0.0-alpha.8.3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const WailsAppPkgPath = "github.com/wailsapp/wails/v3/pkg/application"

WailsAppPkgPath is the official import path of Wails v3's application package.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileCreator

type FileCreator interface {
	Create(path string) (io.WriteCloser, error)
}

FileCreator abstracts away file and directory creation. We use this to implement tests cleanly.

Paths are always relative to the output directory.

A FileCreator must allow concurrent calls to Create transparently. Each io.WriteCloser instance returned by a call to Create will be used by one goroutine at a time; but distinct instances must support concurrent use by distinct goroutines.

var NullCreator FileCreator = FileCreatorFunc(func(path string) (io.WriteCloser, error) {
	return nullWriteCloser{}, nil
})

NullCreator is a dummy file creator implementation. Calls to Create never fail and return a writer that discards all incoming data.

func DirCreator

func DirCreator(outputDir string) FileCreator

DirCreator returns a file creator that creates files relative to the given output directory.

It joins the output directory and the file path, calls os.MkdirAll on the directory part of the result, then os.Create on the full file path.

type FileCreatorFunc

type FileCreatorFunc func(path string) (io.WriteCloser, error)

FileCreatorFunc is an adapter to allow the use of ordinary functions as file creators.

func (FileCreatorFunc) Create

func (f FileCreatorFunc) Create(path string) (io.WriteCloser, error)

Create calls f(path).

type Logger

type Logger interface {
	// Errorf should process its arguments as if they were passed to fmt.Sprintf
	// and report the resulting string to the user as an error message.
	Errorf(format string, a ...any)

	// Warningf should process its arguments as if they were passed to fmt.Sprintf
	// and report the resulting string to the user as a warning message.
	Warningf(format string, a ...any)

	// Infof should process its arguments as if they were passed to fmt.Sprintf
	// and report the resulting string to the user as an informational message.
	Infof(format string, a ...any)

	// Debugf should process its arguments as if they were passed to fmt.Sprintf
	// and report the resulting string to the user as a debug message.
	Debugf(format string, a ...any)

	// Statusf should process its arguments as if they were passed to fmt.Sprintf
	// and report the resulting string to the user as a status message.
	Statusf(format string, a ...any)
}

A Logger instance provides methods to format and report messages intended for the end user.

All Logger methods may be called concurrently by its consumers.

var NullLogger Logger = nullLogger{}

NullLogger is a dummy Logger implementation that discards all incoming messages.

func DefaultPtermLogger

func DefaultPtermLogger(spinner *pterm.SpinnerPrinter) Logger

DefaultPtermLogger returns a Logger implementation that writes to the default pterm printers for each logging level.

If spinner is not nil, it is used to log status updates. The spinner must have been started already.

type PtermLogger

type PtermLogger struct {
	Error   pterm.TextPrinter
	Warning pterm.TextPrinter
	Info    pterm.TextPrinter
	Debug   pterm.TextPrinter
	Spinner *pterm.SpinnerPrinter
}

PtermLogger is a Logger implementation that writes to pterm printers. If any field is nil, PtermLogger discards all messages of that level.

func (*PtermLogger) Debugf

func (logger *PtermLogger) Debugf(format string, a ...any)

func (*PtermLogger) Errorf

func (logger *PtermLogger) Errorf(format string, a ...any)

func (*PtermLogger) Infof

func (logger *PtermLogger) Infof(format string, a ...any)

func (*PtermLogger) Statusf

func (logger *PtermLogger) Statusf(format string, a ...any)

func (*PtermLogger) Warningf

func (logger *PtermLogger) Warningf(format string, a ...any)

type SystemPaths

type SystemPaths struct {
	ContextPackage     string
	ApplicationPackage string
}

SystemPaths holds resolved paths of required system packages.

Jump to

Keyboard shortcuts

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