readlog

package
v0.0.0-...-f2d3015 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JunkDataUID      = 0x00000001 // special MessageUID just for junk data indications
	InvalidRecordUID = 0x00000002 // special MessageUID for records that could not be parsed properly
)
View Source
const (
	DebugEscapeByte   = 0xA7
	DebugSegmentStart = 0xA9
	DebugSegmentEnd   = 0xAF
)
View Source
const (
	VariableWidthOrPrecision = -1
)

Variables

This section is empty.

Functions

func Filter

func Filter(input <-chan Record, output chan<- Record, minLevel LogLevel, earliest, latest model.VirtualTime)

func GetLines

func GetLines(filename string, lineNum uint32, count uint32) ([]string, error)

func LogColor

func LogColor(level LogLevel, msg string) string

func LogColorRGB

func LogColorRGB(level LogLevel) color.RGBA

LogColorRGB is for chart code, but it's kept here so that it can be synchronized with LogColor

func Parse

func Parse(elfPaths []string, inputStream io.Reader, recordsOut chan<- Record, follow bool, fixTime bool) error

func ParseStream

func ParseStream(inputStream io.Reader, outputCh chan<- []byte, junkCh chan<- []byte, follow bool) error

func Render

func Render(record Record) string

func Renderer

func Renderer(input <-chan Record, output io.Writer, srcPath string, full bool) error

Types

type ArgType

type ArgType uint8
const (
	ArgNone ArgType = iota
	ArgChar         // char to be printed as a char
	ArgByte         // char-sized integer
	ArgShort
	ArgInt
	ArgLong
	ArgLongLong
	ArgPtrDiffT
	ArgIntMaxT
	ArgSizeT
	ArgVoidPtr
	ArgDouble
	ArgString
)

func (ArgType) AsInt64

func (at ArgType) AsInt64(v interface{}) int64

func (ArgType) AsUint64

func (at ArgType) AsUint64(v interface{}) uint64

func (ArgType) Decode

func (at ArgType) Decode(record []byte) interface{}

func (ArgType) DecodeExtendedStorage

func (at ArgType) DecodeExtendedStorage(data []byte) (consumed int, isLast bool, result interface{})

func (ArgType) IsStoredExtended

func (at ArgType) IsStoredExtended() bool

func (ArgType) Size

func (at ArgType) Size() int

type DebugData

type DebugData struct {
	JunkData      *MessageMetadata
	InvalidRecord *MessageMetadata
	RecordTypes   map[uint32]*MessageMetadata
	// contains filtered or unexported fields
}

func LoadDebugData

func LoadDebugData(paths []string) (*DebugData, error)

func (*DebugData) Decode

func (dd *DebugData) Decode(record []byte) (Record, error)

Decode always returns a record, but sometimes also returns an error

func (*DebugData) LookupMetadata

func (dd *DebugData) LookupMetadata(uid uint32) (*MessageMetadata, error)

type DebugFile

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

func LoadDebugFile

func LoadDebugFile(path string) (*DebugFile, error)

func (*DebugFile) DecodeMetadata

func (f *DebugFile) DecodeMetadata(uid uint32) (*MessageMetadata, error)

func (*DebugFile) ReadCStringFrom

func (f *DebugFile) ReadCStringFrom(sym elf.Symbol, expectedSection string) (string, error)

func (*DebugFile) ReadCStringFromAddress

func (f *DebugFile) ReadCStringFromAddress(addr uint32, expectedPrefix, expectedSection string) (string, error)

func (*DebugFile) ReadSymbolInto

func (f *DebugFile) ReadSymbolInto(sym elf.Symbol, expectedSection string, output interface{}) error

type Formatter

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

func ParseFormat

func ParseFormat(format string) (Formatter, error)

func (*Formatter) ArgTypes

func (f *Formatter) ArgTypes() (ats []ArgType)

func (*Formatter) Render

func (f *Formatter) Render(arguments []interface{}) string

type LogLevel

type LogLevel int
const (
	LogInvalid  LogLevel = 0
	LogCritical LogLevel = 1
	LogWarning  LogLevel = 2
	LogInfo     LogLevel = 3
	LogDebug    LogLevel = 4
	LogTrace    LogLevel = 5
)

func LogLevels

func LogLevels() []LogLevel

func ParseLogLevel

func ParseLogLevel(raw uint32) (LogLevel, error)

func ParseStringLogLevel

func ParseStringLogLevel(raw string) (LogLevel, error)

func (LogLevel) String

func (ll LogLevel) String() string

type MessageMetadata

type MessageMetadata struct {
	MessageUID uint32
	StableID   string
	LogLevel   LogLevel
	Format     Formatter
	Filename   string
	LineNum    uint32
}

func (*MessageMetadata) ParseRecord

func (m *MessageMetadata) ParseRecord(record []byte) ([]interface{}, error)

type Record

type Record struct {
	Metadata     *MessageMetadata
	ArgumentData []interface{}
	Timestamp    model.VirtualTime
}

type Specifier

type Specifier struct {
	Type              ArgType
	Base              int
	Width             int
	Precision         int
	Signed            bool
	FlagZeropad       bool
	FlagLeft          bool
	FlagPlus          bool
	FlagSpace         bool
	FlagHash          bool
	FlagPrecision     bool
	FlagUppercase     bool
	FlagExponential   bool
	FlagAdaptExponent bool
}

func (Specifier) Render

func (s Specifier) Render(i interface{}) (block string)

type WaitingReader

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

func (*WaitingReader) Read

func (w *WaitingReader) Read() (b byte, err error)

Jump to

Keyboard shortcuts

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