parsercommon

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: BSD-2-Clause Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	NO_VERSION = -1
)

Variables

View Source
var (
	ErrEOL     = &ParserError{"End of log line"}
	ErrNoSpace = &ParserError{"No space found"}

	ErrPriorityNoStart  = &ParserError{"No start char found for priority"}
	ErrPriorityEmpty    = &ParserError{"Priority field empty"}
	ErrPriorityNoEnd    = &ParserError{"No end char found for priority"}
	ErrPriorityTooShort = &ParserError{"Priority field too short"}
	ErrPriorityTooLong  = &ParserError{"Priority field too long"}
	ErrPriorityNonDigit = &ParserError{"Non digit found in priority"}

	ErrVersionNotFound = &ParserError{"Can not find version"}

	ErrTimestampUnknownFormat = &ParserError{"Timestamp format unknown"}

	ErrHostnameNotFound = &ParserError{"Hostname not found"}
)

Functions

func FindNextSpace

func FindNextSpace(buff []byte, from int, l int) (int, error)

func IsDigit

func IsDigit(c byte) bool

func Parse2Digits

func Parse2Digits(buff []byte, cursor *int, l int, min int, max int, e error) (int, error)

func ParseHostname

func ParseHostname(buff []byte, cursor *int, l int) (string, error)

func ParseVersion

func ParseVersion(buff []byte, cursor *int, l int) (int, error)

https://tools.ietf.org/html/rfc5424#section-6.2.2

func ShowCursorPos

func ShowCursorPos(buff []byte, cursor int)

Types

type Facility

type Facility struct {
	Value int
}

type ParserError

type ParserError struct {
	ErrorString string
}

func (*ParserError) Error

func (err *ParserError) Error() string

type Priority

type Priority struct {
	P int
	F Facility
	S Severity
}

func NewPriority

func NewPriority(p int) *Priority

func ParsePriority

func ParsePriority(buff []byte, cursor *int, l int) (*Priority, error)

https://tools.ietf.org/html/rfc3164#section-4.1

type Severity

type Severity struct {
	Value int
}

Jump to

Keyboard shortcuts

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