Documentation ¶
Index ¶
- func CreateEgressOperators(read func() ([]byte, error)) error
- func CreateIngressOperators(read func() ([]byte, error)) error
- func InitEgressOperators(config []accessdata.Operator) error
- func InitIngressOperators(config []accessdata.Operator) error
- func ReadOperators(buf []byte) ([]accessdata.Operator, error)
- func SetEgressLogStatus(enabled bool)
- func SetIngressLogStatus(enabled bool)
- func SetPingLogStatus(enabled bool)
- func Write[O OutputHandler, F accessdata.Formatter](entry *accessdata.Entry)
- type DebugOutputHandler
- type LogOutputHandler
- type NilOutputHandler
- type OutputHandler
- type TestOutputHandler
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateEgressOperators ¶
CreateEgressOperators - provides creation of egress operators
func CreateIngressOperators ¶
CreateIngressOperators - provides creation of ingress operators from a []byte
func InitEgressOperators ¶
func InitEgressOperators(config []accessdata.Operator) error
InitEgressOperators - allows configuration of access accesslog attributes for egress traffic
func InitIngressOperators ¶
func InitIngressOperators(config []accessdata.Operator) error
InitIngressOperators - allows configuration of access accesslog attributes for ingress traffic
func ReadOperators ¶
func ReadOperators(buf []byte) ([]accessdata.Operator, error)
ReadOperators - read the operators from a []byte
func SetEgressLogStatus ¶
func SetEgressLogStatus(enabled bool)
SetEgressLogStatus - enable/disable egress logging
func SetIngressLogStatus ¶
func SetIngressLogStatus(enabled bool)
SetIngressLogStatus - enable/disable ingress logging
func SetPingLogStatus ¶
func SetPingLogStatus(enabled bool)
SetPingLogStatus - enable/disable ping logging
func Write ¶
func Write[O OutputHandler, F accessdata.Formatter](entry *accessdata.Entry)
Write - templated function handling writing the access data utilizing the OutputHandler and Formatter
Types ¶
type DebugOutputHandler ¶
type DebugOutputHandler struct{}
DebugOutputHandler - output to stdio
func (DebugOutputHandler) Write ¶
func (DebugOutputHandler) Write(items []accessdata.Operator, data *accessdata.Entry, formatter accessdata.Formatter)
type LogOutputHandler ¶
type LogOutputHandler struct{}
LogOutputHandler - output to accesslog
func (LogOutputHandler) Write ¶
func (LogOutputHandler) Write(items []accessdata.Operator, data *accessdata.Entry, formatter accessdata.Formatter)
type NilOutputHandler ¶
type NilOutputHandler struct{}
NilOutputHandler - no output
func (NilOutputHandler) Write ¶
func (NilOutputHandler) Write(_ []accessdata.Operator, _ *accessdata.Entry, _ accessdata.Formatter)
type OutputHandler ¶
type OutputHandler interface {
Write(items []accessdata.Operator, data *accessdata.Entry, formatter accessdata.Formatter)
}
OutputHandler - template parameter for accesslog output
Example ¶
package main import ( "fmt" "github.com/gotemplates/host/accessdata" ) func main() { fmt.Printf("test: Output[NilOutputHandler,data.TextFormatter](nil,nil)\n") logTest[NilOutputHandler, accessdata.TextFormatter](nil, nil) fmt.Printf("test: Output[DebugOutputHandler,data.JsonFormatter](operators,data)\n") ops := []accessdata.Operator{{"error", "message"}} logTest[DebugOutputHandler, accessdata.JsonFormatter](ops, accessdata.NewEmptyEntry()) fmt.Printf("test: Output[TestOutputHandler,data.JsonFormatter](nil,nil)\n") logTest[TestOutputHandler, accessdata.JsonFormatter](nil, nil) fmt.Printf("test: Output[TestOutputHandler,data.JsonFormatter](ops,data)\n") logTest[TestOutputHandler, accessdata.JsonFormatter](ops, accessdata.NewEmptyEntry()) fmt.Printf("test: Output[LogOutputHandler,data.JsonFormatter](ops,data)\n") logTest[LogOutputHandler, accessdata.JsonFormatter](ops, accessdata.NewEmptyEntry()) } func logTest[O OutputHandler, F accessdata.Formatter](items []accessdata.Operator, data *accessdata.Entry) { var o O var f F o.Write(items, data, f) }
Output: test: Output[NilOutputHandler,data.TextFormatter](nil,nil) test: Output[DebugOutputHandler,data.JsonFormatter](operators,data) {"error":"message"} test: Output[TestOutputHandler,data.JsonFormatter](nil,nil) test: Write() -> [{}] test: Output[TestOutputHandler,data.JsonFormatter](ops,data) test: Write() -> [{"error":"message"}] test: Output[LogOutputHandler,data.JsonFormatter](ops,data)
type TestOutputHandler ¶
type TestOutputHandler struct{}
TestOutputHandler - special use case of DebugOutputHandler for testing examples
func (TestOutputHandler) Write ¶
func (TestOutputHandler) Write(items []accessdata.Operator, data *accessdata.Entry, formatter accessdata.Formatter)