package logging

import "github.com/evanw/esbuild/internal/logging"

Index

Constants

const SupportsColorEscapes = false

Functions

func ComputeLineAndColumn

func ComputeLineAndColumn(text string) (lineCount int, columnCount, lastLineStart int)

Types

type Log

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

func NewDeferLog

func NewDeferLog() (Log, func() []Msg)

func NewStderrLog

func NewStderrLog(options StderrOptions) (Log, func() MsgCounts)

func (Log) AddError

func (log Log) AddError(source Source, loc ast.Loc, text string)

func (Log) AddRangeError

func (log Log) AddRangeError(source Source, r ast.Range, text string)

func (Log) AddRangeWarning

func (log Log) AddRangeWarning(source Source, r ast.Range, text string)

func (Log) AddWarning

func (log Log) AddWarning(source Source, loc ast.Loc, text string)

type LogLevel

type LogLevel int8
const (
	LevelNone LogLevel = iota
	LevelInfo
	LevelWarning
	LevelError
)

type Msg

type Msg struct {
	Source Source
	Start  int32
	Length int32
	Text   string
	Kind   MsgKind
}

func (Msg) String

func (msg Msg) String(options StderrOptions, terminalInfo TerminalInfo) string

type MsgCounts

type MsgCounts struct {
	Errors   int
	Warnings int
}

func (MsgCounts) String

func (counts MsgCounts) String() string

type MsgDetail

type MsgDetail struct {
	Path    string
	Line    int
	Column  int
	Kind    string
	Message string

	// Source == SourceBefore + SourceMarked + SourceAfter
	Source       string
	SourceBefore string
	SourceMarked string
	SourceAfter  string

	Indent string
	Marker string
}

type MsgKind

type MsgKind uint8
const (
	Error MsgKind = iota
	Warning
)

type Source

type Source struct {
	Index        uint32
	IsStdin      bool
	AbsolutePath string
	PrettyPath   string
	Contents     string
}

func (*Source) RangeOfString

func (s *Source) RangeOfString(loc ast.Loc) ast.Range

func (*Source) TextForRange

func (s *Source) TextForRange(r ast.Range) string

type StderrColor

type StderrColor uint8
const (
	ColorIfTerminal StderrColor = iota
	ColorNever
	ColorAlways
)

type StderrOptions

type StderrOptions struct {
	IncludeSource      bool
	ErrorLimit         int
	ExitWhenLimitIsHit bool
	Color              StderrColor
	LogLevel           LogLevel
}

type TerminalInfo

type TerminalInfo struct {
	IsTTY           bool
	UseColorEscapes bool
	Width           int
}

func GetTerminalInfo

func GetTerminalInfo(*os.File) TerminalInfo

Source Files

logging.go logging_other.go

Version
v0.4.3
Published
May 28, 2020
Platform
windows/amd64
Imports
4 packages
Last checked
12 minutes ago

Tools for package owners.