logs

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogWorkQueue chan chan LogWorkRequest
View Source
var LoggingType = map[string]interface{}{
	"Rabbit":  PublishRabbit,
	"Elastic": PublishElastic}
View Source
var WorkQueue = make(chan LogWorkRequest, 1000)

Functions

func PublishElastic

func PublishElastic(reqLogging *RequestLogging)

func PublishLog

func PublishLog(reqLogging *RequestLogging)

func PublishRabbit

func PublishRabbit(reqLogging *RequestLogging)

func StartDispatcher

func StartDispatcher(nworkers int)

Types

type LogWorkRequest

type LogWorkRequest struct {
	Name      string
	LogToSave RequestLogging
}

type RequestLogging

type RequestLogging struct {
	Method      string
	Uri         string
	RequestBody string
	Host        string
	UserAgent   string
	RemoteAddr  string
	RemoteIp    string
	Headers     string
	QueryArgs   string
	DateTime    string
	Response    string
	ElapsedTime int64
	StatusCode  int
	ServiceName string
	IndexName   string
}

func NewRequestLogging

func NewRequestLogging(c *fasthttp.RequestCtx, queryArgs []byte, headers []byte, currentDate string, elapsedTime int64, serviceName string, indexName string) RequestLogging

func (*RequestLogging) Save

func (reqLogging *RequestLogging) Save()

type Worker

type Worker struct {
	ID          int
	Work        chan LogWorkRequest
	WorkerQueue chan chan LogWorkRequest
	QuitChan    chan bool
}

func NewWorker

func NewWorker(id int, workerQueue chan chan LogWorkRequest) Worker

NewWorker creates, and returns a new Worker object. Its only argument is a channel that the worker can add itself to whenever it is done its work.

func (*Worker) Start

func (w *Worker) Start()

This function "starts" the worker by starting a goroutine, that is an infinite "for-select" loop.

func (*Worker) Stop

func (w *Worker) Stop()

Stop tells the worker to stop listening for work requests.

Note that the worker will only stop *after* it has finished its work.

Jump to

Keyboard shortcuts

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