internal

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Printer printer         = nil
	LogTo   *zerolog.Logger = nil

	DevMode = false

	DefaultConfig = Config{
		LinesBefore: 4,
		LinesAfter:  2,
	}
)

Functions

func FindEndOfFunction

func FindEndOfFunction(srcLines []string, lineWithFunctionStart int) int

func MatchFunc

func MatchFunc(line string) bool

func MatchVarName

func MatchVarName(line string) *string

func PrintErro

func PrintErro(source error, a ...any) error

func ReadSource

func ReadSource(filepath string) []string

func ReadSourceFs

func ReadSourceFs(filepath string, afs afero.Fs) []string

func TestPrinterFunc

func TestPrinterFunc(t *TestPrinter) printer

Types

type Config added in v0.6.1

type Config struct {
	LinesBefore int //How many lines to print *before* the error line when printing source code
	LinesAfter  int //How many lines to print *after* the error line when printing source code
}

Config holds the configuration for a logger

type PrintSourceOptions

type PrintSourceOptions struct {
	ShortFileName string
	FuncLine      int
	FailingLine   int
	DebugLine     int
	StartLine     int
	EndLine       int
	Highlighted   map[int][]int
	UsedVars      []UsedVar
	Stack         []StackTraceItem
}

PrintSourceOptions represents config for (*logger).getData func

type StackTraceItem

type StackTraceItem struct {
	CallingObject string
	Args          []string
	SourcePathRef string
	SourceLineRef int
	MysteryNumber int64 // don't know what this is, no documentation found, if you know please let me know via a PR !
}

StackTraceItem represents parsed information of a stack trace item

type TestPrinter

type TestPrinter struct {
	Output []string
}

func NewTestPrinter

func NewTestPrinter() *TestPrinter

func (*TestPrinter) Printf

func (t *TestPrinter) Printf(format string, data ...any)

type UsedVar

type UsedVar struct {
	Name            string
	Value           interface{}
	LastWrite       int
	SourceLastWrite string
}

Jump to

Keyboard shortcuts

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