logfmt

package
v0.0.0-...-e92691c Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2019 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

View Source
const ELFFV = "1.0"

ELFFV = Extended Log File Format Version

Variables

View Source
var (
	CRLF  = EOL{0x0D, 0x0A}
	LF    = EOL{0x0A}
	TAB   = EOL{0x09}
	SPACE = EOL{0x20}
)

Line terminator options

Functions

This section is empty.

Types

type Directive

type Directive struct {
	Version   string
	Software  string
	Date      string
	StartDate string
	EndDate   string
	Fields    []string
	Remark    string
}

Directive contains logfile metadata

func NewDirective

func NewDirective(software, version, remark string, fields ...string) *Directive

NewDirective ...

func (*Directive) ToBytes

func (d *Directive) ToBytes() []byte

ToBytes converts directive to

type EOL

type EOL []byte

EOL is the end of line terminator described here: https://www.w3.org/TR/WD-logfile

type Entry

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

Entry contains data for a log entry

func NewEntry

func NewEntry() *Entry

NewEntry returns an initialized entry struct

func (*Entry) Append

func (e *Entry) Append(fields ...Field) *Entry

Append adds one or many fields to the entry

func (*Entry) ToBytes

func (e *Entry) ToBytes() []byte

ToBytes converts and entry to a byte slice

type Field

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

Field contains part of an entry

func Bytes

func Bytes(n int) Field

Bytes transferred

func Comment

func Comment(c string) Field

Comment returned with status code

func DNS

func DNS(dns string) Field

DNS name

func ErrorMsg

func ErrorMsg(err error) Field

ErrorMsg contains an error message

func IP

func IP(ipaddr string) Field

IP address and port

func Method

func Method(method string) Field

Method ...

func NewField

func NewField(data []byte) Field

NewField returns a newly initialized field

func Status

func Status(code int) Field

Status code

func TimeTaken

func TimeTaken(dur time.Duration) Field

TimeTaken for transaction to complete in seconds

func URI

func URI(uri string) Field

URI ...

func URIQuery

func URIQuery(uri string) Field

URIQuery query portion of URI

func URIStem

func URIStem(uri string) Field

URIStem stem portion of URI (omit query)

Jump to

Keyboard shortcuts

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