diag

package
v1.4.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package diag exposes error types used throughout converter and a method to pretty-print them to the screen.

Package diag exposes error types used throughout converter and a method to pretty-print them to the screen.

Package diag exposes error types used throughout converter and a method to pretty-print them to the screen.

Index

Constants

View Source
const Text = ".txt"

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	// Severity holds the severity level of this Diagnostic.
	Severity Severity

	Summary string
	Detail  string
}

Diagnostic is an individual diagnostic message. Diagnostic messages can have different levels of severities.

func (Diagnostic) Error

func (d Diagnostic) Error() string

Error implements error.

func (Diagnostic) String

func (d Diagnostic) String() string

type Diagnostics

type Diagnostics []Diagnostic

Diagnostics is a collection of diagnostic messages.

func (*Diagnostics) Add

func (ds *Diagnostics) Add(severity Severity, message string)

Add adds an individual Diagnostic to the diagnostics list.

func (*Diagnostics) AddAll

func (ds *Diagnostics) AddAll(diags Diagnostics)

AddAll adds all given diagnostics to the diagnostics list.

func (*Diagnostics) AddWithDetail

func (ds *Diagnostics) AddWithDetail(severity Severity, message string, detail string)

Add adds an individual Diagnostic to the diagnostics list.

func (Diagnostics) Error

func (ds Diagnostics) Error() string

Error implements error.

func (Diagnostics) GenerateReport

func (ds Diagnostics) GenerateReport(writer io.Writer, reportType string, bypassErrors bool) error

func (*Diagnostics) HasSeverityLevel

func (ds *Diagnostics) HasSeverityLevel(severity Severity) bool

func (*Diagnostics) RemoveDiagsBySeverity

func (ds *Diagnostics) RemoveDiagsBySeverity(severity Severity)

type Severity

type Severity int

Severity denotes the severity level of a diagnostic. The zero value of severity is invalid.

const (
	SeverityLevelInfo Severity = iota + 1
	SeverityLevelWarn
	SeverityLevelError
	SeverityLevelCritical
)

Supported severity levels.

func (Severity) String

func (s Severity) String() string

Jump to

Keyboard shortcuts

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