utils

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Chars = [...]string{
	log.DebugLevel: "D",
	log.InfoLevel:  "I",
	log.WarnLevel:  "W",
	log.ErrorLevel: "E",
	log.FatalLevel: "F",
}

Chars mapping.

View Source
var Colors = [...]int{
	log.DebugLevel: gray,
	log.InfoLevel:  blue,
	log.WarnLevel:  yellow,
	log.ErrorLevel: red,
	log.FatalLevel: red,
}

Colors mapping.

View Source
var Strings = [...]string{
	log.DebugLevel: "DEBUG",
	log.InfoLevel:  "INFO",
	log.WarnLevel:  "WARN",
	log.ErrorLevel: "ERROR",
	log.FatalLevel: "FATAL",
}

Strings mapping.

Functions

func FetchHeaders

func FetchHeaders(r *http.Request, list []string) map[string]string

FetchHeaders extracts specified headers from request

func InitLogger

func InitLogger(format string, level string) error

InitLogger sets log level, format and output

func IsTTY

func IsTTY() bool

IsTTY returns true if program is running with TTY

Types

type LogHandler

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

LogHandler with TTY awareness

func (*LogHandler) HandleLog

func (h *LogHandler) HandleLog(e *log.Entry) error

HandleLog is a method called by logger to record a log entry

Jump to

Keyboard shortcuts

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