mklog

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LevelMap = map[Level]string{
		LevelDebug: "Debug",
		LevelInfo:  "Info",
		LevelError: "Error",
	}

	LevelColorMap = map[Level]string{
		LevelDebug: colorYellow,
		LevelInfo:  colorGreen,
		LevelError: colorRed,
	}
	NoColor = os.Getenv("TERM") == "dumb" ||
		(!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
)

Functions

This section is empty.

Types

type Level

type Level int
const (
	LevelDebug Level = 0
	LevelInfo  Level = 1
	LevelError Level = 2

	ContextLog = "mklog-instance"
)

type Logger

type Logger interface {
	SetOutput(writer io.Writer)
	SetLevel(lvl Level)
	Context() context.Context
	GetLogID() string
	Debugf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Errorf(format string, v ...interface{})
}

func New

func New() Logger

func NewWithContext

func NewWithContext(ctx context.Context) Logger

func NewWithReq

func NewWithReq(req *http.Request) Logger

Jump to

Keyboard shortcuts

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