logging

package
v0.0.0-...-1efd103 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultReporter = WriterReporter{os.Stderr}

DefaultReporter is the default reporter, which writes to stderr.

Functions

func AnnotateSourceSpan

func AnnotateSourceSpan(source *sources.Source, span ast.Span) string

AnnotateSourceSpan annotates a span from a single line in the source code. The output looks like:

(contents) or (other thing)
 ~~~~~~~~

func LocationErrorf

func LocationErrorf(source *sources.Source, span ast.Span, f string, args ...interface{}) error

LocationErrorf adds an error from a specific location.

func LocationWarnf

func LocationWarnf(source *sources.Source, span ast.Span, f string, args ...interface{}) error

LocationWarnf adds a warning from a specific location.

Types

type Reporter

type Reporter interface {
	AddError(error)
}

Reporter is an interface for reporting errors and warnings.

type WriterReporter

type WriterReporter struct {
	io.Writer
}

WriterReporter is a simple adapter for writing logs to an io.Writer. The default reporter is a WriterReporter(os.Stderr).

func (WriterReporter) AddError

func (w WriterReporter) AddError(err error)

AddError implements Reporter.

Jump to

Keyboard shortcuts

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