joblogger

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2016 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const TYPE = "job-logger"

Type is a short name for the middleware

Variables

This section is empty.

Functions

func CliFlags

func CliFlags() []cli.Flag

CliFlags will be used by Vulcand construct help and CLI command for the vctl command

func FromCli

func FromCli(context *cli.Context) (plugin.Middleware, error)

FromCli constructs the middleware from the command line

func FromOther

func FromOther(middleware Middleware) (plugin.Middleware, error)

FromOther Will be called by Vulcand when engine or API will read the middleware from the serialized format. It's important that the signature of the function will be exactly the same, otherwise Vulcand will fail to register this middleware. The first and the only parameter should be the struct itself, no pointers and other variables. Function should return middleware interface and error in case if the parameters are wrong.

func GetSpec

func GetSpec() *plugin.MiddlewareSpec

GetSpec describes the job-logger middleware

Types

type Handler

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

Handler implements http.Handler

func NewHandler

func NewHandler(conn *connection.Connection, backendID string, next http.Handler) *Handler

NewHandler constructs a new handler

func (*Handler) ServeHTTP

func (handler *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP will be called each time the request hits the location with this middleware activated

type Middleware

type Middleware struct {
	BackendID, RedisURI, RedisQueueName string
	Conn                                *connection.Connection
}

Middleware is a vulcand middleware that logs to redis

func NewMiddleware

func NewMiddleware(RedisURI, RedisQueueName, BackendID string) (*Middleware, error)

NewMiddleware constructs new Middleware instances

func (*Middleware) NewHandler

func (middleware *Middleware) NewHandler(next http.Handler) (http.Handler, error)

NewHandler returns a new Handler instance

func (*Middleware) String

func (middleware *Middleware) String() string

String will be called by loggers inside Vulcand and command line tool.

Jump to

Keyboard shortcuts

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