logger

package
v0.0.0-...-0e8a65c Latest Latest
Warning

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

Go to latest
Published: May 20, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(theLogger *logrus.Logger, cfg ...Config) iris.HandlerFunc

New returns the logger middleware receives two parameters, both of them optionals first is the logger, which normally you set to the 'iris.Logger' if logger is nil then the middlewares makes one with the default configs. second is optional configs(logger.Config)

func NewLogFile

func NewLogFile(theLogger *logrus.Entry, cfg ...Config) iris.HandlerFunc

Types

type Config

type Config struct {
	// Status displays status code (bool)
	Status bool
	// IP displays request's remote address (bool)
	IP bool
	// Method displays the http method (bool)
	Method bool
	// Path displays the request path (bool)
	Path bool
	// EnableColors defaults to false
	EnableColors bool
}

Config are the options of the logger middlweare contains 5 bools Status, IP, Method, Path, EnableColors if set to true then these will print

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns an options which all properties are true except EnableColors

func (Config) Merge

func (c Config) Merge(cfg []Config) (config Config)

Merge merges the default with the given config and returns the result

Jump to

Keyboard shortcuts

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