Documentation ¶
Overview ¶
Package decoder provides several decoders for differently encoded trice streams.
Index ¶
Constants ¶
const ( // LittleEndian is true for little endian trice data. LittleEndian = true // flag value for TargetEndianess BigEndian = false )
Variables ¶
var ( // Verbose gives mor information on output if set. The value is injected from main packages. Verbose bool // ShowID is used as format string for displaying the first trice ID at the start of each line if not "". ShowID string // LastTriceID is last decoded ID. It is used for switch -showID. LastTriceID id.TriceID // Encoding describes the way the byte stream is coded. Encoding string // TargetEndianess, if bigEndian assumes a big endian encoded trice stream from the target. // To keep target load small, the encoded trice stream from the target matches the target endianess, what us usually littleEndian. TargetEndianess string // TestTableMode is a special option for easy decoder test table generation. TestTableMode bool // Unsigned if true, forces hex and in values printed as unsigned values. Unsigned bool // DebugOut enables debug information. DebugOut = false // DumpLineByteCount is the bytes per line for the DUMP decoder. DumpLineByteCount int ShowTargetTimestamp string )
Functions ¶
func Translate ¶
func Translate(w io.Writer, sw *emitter.TriceLineComposer, lut id.TriceIDLookUp, m *sync.RWMutex, rc io.ReadCloser) error
Translate performs the trice log task.
Bytes are read with rc. Then according decoder.Encoding they are translated into strings. Each read returns the amount of bytes for one trice. rc is called on every Translate returns true on io.EOF or false on hard read error or sigterm.
Types ¶
type CHAR ¶ added in v0.34.0
type CHAR struct {
// contains filtered or unexported fields
}
CHAR is the Decoding instance for DUMP encoded trices.
type COBS ¶ added in v0.34.0
type COBS struct { COBSModeDescriptor uint32 // contains filtered or unexported fields }
COBS is the Decoding instance for COBS encoded trices.
func (*COBS) Read ¶ added in v0.34.0
Read is the provided read method for COBS decoding and provides next string as byte slice.
It uses inner reader p.in and internal id look-up table to fill b with a string. b is a slice of bytes with a len for the max expected string size. n is the count of read bytes inside b. Read returns usually one complete trice string or nothing but can return concatenated trice strings, each ending with a newline despite the last one, when messages added. Read does not process all internally read complete trice packages to be able later to separate trices within one line to keep them separated for color processing. Therefore Read needs to be called cyclically even after returning io.EOF to process internal data. When Read returns n=0, all processable complete trice packages are done, but the start of a following trice package can be already inside the internal buffer. In case of a not matching cycle, a warning message in trice format is prefixed. In case of invalid package data, error messages in trice format are returned and the package is dropped.
type DUMP ¶ added in v0.34.0
type DUMP struct {
// contains filtered or unexported fields
}
DUMP is the Decoding instance for DUMP encoded trices.
type Decoder ¶
Decoder is providing a byte reader returning decoded trice's. setInput allows switching the input stream to a different source.
func NewCHARDecoder ¶ added in v0.34.0
NewCHARDecoder provides a character terminal output option for the trice tool.
func NewCOBSRDecoder ¶ added in v0.34.0
NewCOBSRDecoder provides an EscDecoder instance.
l is the trice id list in slice of struct format. in is the usable reader for the input bytes.
func NewDUMPDecoder ¶ added in v0.34.0
NewDUMPDecoder provides a hex dump option for incoming bytes.