glog

package module
v0.0.0-...-b472064 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

README

glog

Documentation

Index

Constants

View Source
const (
	OutputStdout = "stdout" // default
	OutputStderr = "stderr"
	OutputFile   = "file"

	FormatJSON = "json" // default
	FormatText = "text"

	LevelDebug = "debug" // default
	LevelInfo  = "info"
	LevelWarn  = "warn"
	LevelError = "error"
	LevelFatal = "fatal"
	LevelPanic = "panic"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string)

func Error

func Error(msg string)

func Fatal

func Fatal(msg string)

func Info

func Info(msg string)

func SetDefaultLog

func SetDefaultLog(dfl Logger)

func Warn

func Warn(msg string)

Types

type Logger

type Logger interface {
	AddCallerSkip(n int) Logger

	WithField(key string, val interface{}) Logger
	WithFields(key string, val interface{}, kvs ...interface{}) Logger

	Data(val interface{}) Logger
	Action(val string) Logger
	Request(val interface{}) Logger
	Response(val interface{}) Logger

	Debug(msg string)
	Info(msg string)
	Warn(msg string)
	Error(msg string)
	Fatal(msg string)
}

func Action

func Action(val string) Logger

func Attach

func Attach(l *zap.Logger) Logger

func Data

func Data(val interface{}) Logger

func GetDefaultLog

func GetDefaultLog() Logger

func New

func New(opt *Options) Logger

func Request

func Request(val interface{}) Logger

func Response

func Response(val interface{}) Logger

func WithField

func WithField(key string, val interface{}) Logger

func WithFields

func WithFields(key string, val interface{}, kvs ...interface{}) Logger

type Options

type Options struct {
	Output      string `json:"output" yaml:"output"`
	Format      string `json:"format" yaml:"format"`
	Level       string `json:"level" yaml:"level"`
	TimeFormat  string `json:"time_format" yaml:"time_format"`
	NoAddCaller bool   `json:"no_caller" yaml:"no_caller"`

	// Output == OutputFile
	FileName string `json:"file_name" yaml:"file_name"`
	Size     int    `json:"size" yaml:"size"`
}

Jump to

Keyboard shortcuts

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