internal

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 15 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: 0,
		LinesAfter:  0,
	}
)

Functions

func ExtractFilename

func ExtractFilename(fullPath string) string

func GoFindEndOfFunction

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

func GoLastWriteToVar

func GoLastWriteToVar(s string, varName string) int

func GolangFindErrorOrigin

func GolangFindErrorOrigin(lines []string, logLine int) ([]int, error)

func MatchFunc

func MatchFunc(line string) bool

func MatchVarName

func MatchVarName(line string) *string

func OpeningClosePos

func OpeningClosePos(s string) (int, int)

func PrintErro

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

func PrintError

func PrintError(fileName string, debugLine int) 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

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
	LogLine       int
	StartLine     int
	EndLine       int
	Highlighted   map[int][]int
	UsedVars      []UsedVar
	Stack         []StackTraceItem
}

PrintSourceOptions represents config for (*logger).getData func

func GoGetData

func GoGetData(
	lines []string,
	file string,
	logLine int,
	linesBefore int,
	linesAfter int,
) (*PrintSourceOptions, error)

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
}

func GoFindUsedArgsLastWrite

func GoFindUsedArgsLastWrite(
	funcLine int,
	funcSrc string,
	src []string,
	failingArgs []string) []UsedVar

Jump to

Keyboard shortcuts

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