issues

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package issues provides info & error logging for parsing/compiling amod files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	Level level  `json:"level"`
	Text  string `json:"text"`

	*Location `json:"location"`
}

type IssueList

type IssueList = []Issue

type Location

type Location struct {
	SourceFile  string `json:"sourceFile"`
	Line        int    `json:"line"`
	ColumnStart int    `json:"columnStart"`
	ColumnEnd   int    `json:"columnEnd"`
}

type Log

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

func New

func New() *Log

New will create and return a new Log.

func (Log) AllIssues

func (l Log) AllIssues() IssueList

AllIssues returns a slice of all the current issues in the log.

func (*Log) Error

func (l *Log) Error(location *Location, s string, a ...interface{})

Error will add a new error entry to the log.

func (Log) FirstEntry

func (l Log) FirstEntry() string

FirstEntry provides a way to get the text of the first log entry. This is used when parsing goals input by the user. For the UX we want to manage the output text differently. See amod.go ParseChunk()

func (Log) HasError

func (l Log) HasError() bool

HasError returns whether this log contains at least one error entry.

func (Log) HasIssues

func (l Log) HasIssues() bool

HasIssues returns whether this log contains at least one entry.

func (*Log) Info

func (l *Log) Info(location *Location, s string, a ...interface{})

Info will add a new info entry to the log.

func (Log) String

func (l Log) String() string

String returns the log contents as a string. Each entry ends in a newline.

func (*Log) Warning

func (l *Log) Warning(location *Location, s string, a ...interface{})

Warning will add a new info entry to the log.

func (Log) Write

func (l Log) Write(w io.Writer) error

Write will write the entire log. It will prepend INFO/ERROR and append line numbers (if any) to each log entry.

Jump to

Keyboard shortcuts

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