flog

package
v0.0.0-...-696c873 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApacheCommonLog : {host} {user-identifier} {auth-user-id} [{datetime}] "{method} {request} {protocol}" {response-code} {bytes}
	ApacheCommonLog = "%s - %s [%s] \"%s %s %s\" %d %d"
	// ApacheCombinedLog : {host} {user-identifier} {auth-user-id} [{datetime}] "{method} {request} {protocol}" {response-code} {bytes} "{referrer}" "{agent}"
	ApacheCombinedLog = "%s - %s [%s] \"%s %s %s\" %d %d \"%s\" \"%s\""
	// ApacheErrorLog : [{timestamp}] [{module}:{severity}] [pid {pid}:tid {thread-id}] [client %{client}:{port}] %{message}
	ApacheErrorLog = "[%s] [%s:%s] [pid %d:tid %d] [client %s:%d] %s"
	// RFC3164Log : <priority>{timestamp} {hostname} {application}[{pid}]: {message}
	RFC3164Log = "<%d>%s %s %s[%d]: %s"
	// RFC5424Log : <priority>{version} {iso-timestamp} {hostname} {application} {pid} {message-id} {structured-data} {message}
	RFC5424Log = "<%d>%d %s %s %s %d ID%d %s %s"
	// CommonLogFormat : {host} {user-identifier} {auth-user-id} [{datetime}] "{method} {request} {protocol}" {response-code} {bytes}
	CommonLogFormat = "%s - %s [%s] \"%s %s %s\" %d %d"
	// JSONLogFormat : {"host": "{host}", "user-identifier": "{user-identifier}", "datetime": "{datetime}", "method": "{method}", "request": "{request}", "protocol": "{protocol}", "status", {status}, "bytes": {bytes}, "referer": "{referer}"}
	JSONLogFormat = `` /* 146-byte string literal not displayed */
	// LogFmtLogFormat : host={host} user={user-identifier} timestamp={datetime} method={method} request="{request}" protocol={protocol} status={status} bytes={bytes} referer="{referer}"
	LogFmtLogFormat = `host="%s" user=%s timestamp=%s method=%s request="%s" protocol=%s status=%d bytes=%d referer="%s"`
)
View Source
const (
	Apache      = "02/Jan/2006:15:04:05 -0700"
	ApacheError = "Mon Jan 02 15:04:05 2006"
	RFC3164     = "Jan 02 15:04:05"
	RFC5424     = "2006-01-02T15:04:05.000Z"
	CommonLog   = "02/Jan/2006:15:04:05 -0700"
)

Custom predefined layouts

Variables

This section is empty.

Functions

This section is empty.

Types

type Flog

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

func New

func New(rand *rand.Rand, faker *gofakeit.Faker) *Flog

func (*Flog) LogLine

func (f *Flog) LogLine(format string, t time.Time) string

func (*Flog) NewApacheCombinedLog

func (f *Flog) NewApacheCombinedLog(t time.Time) string

NewApacheCombinedLog creates a log string with apache combined log format

func (*Flog) NewApacheCommonLog

func (f *Flog) NewApacheCommonLog(t time.Time) string

NewApacheCommonLog creates a log string with apache common log format

func (*Flog) NewApacheErrorLog

func (f *Flog) NewApacheErrorLog(t time.Time) string

NewApacheErrorLog creates a log string with apache error log format

func (*Flog) NewCommonLogFormat

func (f *Flog) NewCommonLogFormat(t time.Time) string

NewCommonLogFormat creates a log string with common log format

func (*Flog) NewJSONLogFormat

func (f *Flog) NewJSONLogFormat(t time.Time) string

NewJSONLogFormat creates a log string with json log format

func (*Flog) NewLogFmtLogFormat

func (f *Flog) NewLogFmtLogFormat(t time.Time) string

NewLogFmtLogFormat creates a log string with logfmt log format

func (*Flog) NewRFC3164Log

func (f *Flog) NewRFC3164Log(t time.Time) string

NewRFC3164Log creates a log string with syslog (RFC3164) format

func (*Flog) NewRFC5424Log

func (f *Flog) NewRFC5424Log(t time.Time) string

NewRFC5424Log creates a log string with syslog (RFC5424) format

func (*Flog) RandAuthUserID

func (f *Flog) RandAuthUserID() string

RandAuthUserID generates a random auth user id

func (*Flog) RandHTTPVersion

func (f *Flog) RandHTTPVersion() string

RandHTTPVersion returns a random http version

func (*Flog) RandResourceURI

func (f *Flog) RandResourceURI() string

RandResourceURI generates a random resource URI

Jump to

Keyboard shortcuts

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