parsectx

package
v1.23.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo

type BuildInfo struct {
	GOARCH string   // target architecture
	GOOS   string   // target operating system
	GOROOT paths.FS // GOROOT to use

	EncoreRuntime paths.FS // Encore runtime to use

	BuildTags  []string // additional build tags to set
	CgoEnabled bool

	// Experiments are the enabled experiments.
	Experiments *experiments.Set

	// StaticLink enables static linking of C libraries.
	StaticLink bool

	// Debug enables compiling in debug mode.
	Debug bool

	// Revision specifies the revision of the build.
	Revision string

	// UncommittedChanges, if true, specifies there are uncommitted changes
	// part of the build .
	UncommittedChanges bool

	// MainPkg is the existing main package to use, if any.
	// If None a main package is generated.
	MainPkg option.Option[paths.Pkg]
}

BuildInfo represents the information needed to parse and build an Encore application.

type Context

type Context struct {
	// Ctx provides cancellation.
	Ctx context.Context

	// Log is the configured logger.
	Log zerolog.Logger

	// Build controls what files to build.
	Build BuildInfo

	// MainModuleDir is the directory containing the main module.
	MainModuleDir paths.FS

	// FS holds the fileset used for parsing.
	FS *token.FileSet

	// ParseTests controls whether to parse test files.
	ParseTests bool

	// Errs contains encountered errors.
	Errs *perr.List
}

Context holds all the context for parsing.

func (*Context) Trace

func (c *Context) Trace(op string, kvs ...any) *TraceLogger

Trace traces the execution of a function. It emits trace-level log messages, using the given message and key-value pairs. It returns the logger for logging additional information during the processing.

Usage:

tr := ctx.Trace("operation-name", "key", value)
// ... invoke tr.Emit(...) to log additional information
defer tr.Done()

type TraceLogger

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

func (*TraceLogger) Done

func (t *TraceLogger) Done(kvs ...any)

func (*TraceLogger) Emit

func (t *TraceLogger) Emit(msg string, kvs ...any)

Jump to

Keyboard shortcuts

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