mcla

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: AGPL-3.0 Imports: 9 Imported by: 1

README

MCLA | Minecraft Log Analyzer

A Minecraft crash analyzer written in Go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedIndent = errors.New("Crash report details format incorrect: unexpected indent")
	ErrMissingColon     = errors.New("Crash report details format incorrect: missing colon")
)
View Source
var (
	ErrCrashReportIncomplete = errors.New("Crashreport is incomplete")
)

Functions

func ScanJavaErrorsIntoChan

func ScanJavaErrorsIntoChan(r io.Reader) (<-chan *JavaError, <-chan error)

Types

type AffectedLevel

type AffectedLevel struct {
	Details    ReportDetails `json:"details"`
	Stacktrace Stacktrace    `json:"stacktrace"`
}

-- Affected level --

type Analyzer

type Analyzer struct {
	DB ErrorDB
	// contains filtered or unexported fields
}

func NewAnalyzer

func NewAnalyzer(db ErrorDB) (a *Analyzer)

func (*Analyzer) DoError

func (a *Analyzer) DoError(jerr *JavaError) (matched []SolutionPossibility, err error)

func (*Analyzer) DoLogStream added in v0.4.19

func (a *Analyzer) DoLogStream(c context.Context, r io.Reader) (<-chan *ErrorResult, context.Context)

func (*Analyzer) UpdateErrors added in v0.5.0

func (a *Analyzer) UpdateErrors() (err error)

type CrashReport

type CrashReport struct {
	Description   string                 `json:"description"` // Description:
	Error         *JavaError             `json:"error"`
	HeadThread    HeadThread             `json:"head"`          // -- Head --
	AffectedLevel AffectedLevel          `json:"affectedLevel"` // -- Affected level --
	OtherDetails  map[string]DetailsItem `json:"others"`        // -- <KEY> --
}

func ParseCrashReport

func ParseCrashReport(r io.Reader) (report *CrashReport, err error)

func (*CrashReport) GetDetails

func (report *CrashReport) GetDetails(key string) (value DetailsItem)

type DetailsItem

type DetailsItem struct {
	Details ReportDetails `json:"details"`
}

type ErrorDB

type ErrorDB interface {
	ForEachErrors(callback func(*ErrorDesc) error) (err error)
	GetSolution(id int) (sol *SolutionDesc, err error)
}

type ErrorDesc

type ErrorDesc struct {
	Error     string `json:"error"`
	Message   string `json:"message"`
	Solutions []int  `json:"solutions"`
}

type ErrorResult added in v0.4.19

type ErrorResult struct {
	Error   *JavaError            `json:"error"`
	Matched []SolutionPossibility `json:"matched"`
	File    string                `json:"file,omitempty"`
}

type HeadThread

type HeadThread struct {
	Thread     string     `json:"thread"`
	Stacktrace Stacktrace `json:"stacktrace"`
}

-- Head --

type JavaError

type JavaError struct {
	Class      string     `json:"class"`
	Message    string     `json:"message"`
	Stacktrace Stacktrace `json:"stacktrace"`
	CausedBy   *JavaError `json:"causedBy"`

	// extra infos
	LineNo int `json:"lineNo"` // which line did the error start
}

func ScanJavaErrors

func ScanJavaErrors(r io.Reader) (res []*JavaError, err error)

type ReportDetails

type ReportDetails map[string][]string

Details:

func (ReportDetails) Get

func (d ReportDetails) Get(key string) (value string)

func (ReportDetails) GetValues

func (d ReportDetails) GetValues(key string) (values []string)

func (ReportDetails) Has

func (d ReportDetails) Has(key string) (ok bool)

type SolutionDesc

type SolutionDesc struct {
	Tags        []string `json:"tags"`
	Description string   `json:"description"`
	LinkTo      string   `json:"link_to"`
}

type SolutionPossibility

type SolutionPossibility struct {
	ErrorDesc *ErrorDesc `json:"errorDesc"`
	Match     float32    `json:"match"`
}

type StackInfo

type StackInfo struct {
	Raw    string `json:"raw"`
	Class  string `json:"class"`
	Method string `json:"method"`
}

type Stacktrace

type Stacktrace []StackInfo

Stacktrace:

Directories

Path Synopsis
cmd
Github database
Github database

Jump to

Keyboard shortcuts

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