blog

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Info  = glog.Infof
	Infof = glog.Infof

	Warn  = glog.Warningf
	Warnf = glog.Warningf

	Error  = glog.Errorf
	Errorf = glog.Errorf

	Fatal  = glog.Fatal
	Fatalf = glog.Fatalf

	V = glog.V
)

Functions

func CloseLogs

func CloseLogs()

func Debug

func Debug(args ...interface{})

func InitLogs

func InitLogs(logConfig conf.LogConfig)

InitLogs initializes logs the way we want for blog.

func SetV

func SetV(level int32)

Types

type GlogWriter

type GlogWriter struct{}

GlogWriter serves as a bridge between the standard log package and the glog package.

func (GlogWriter) Write

func (writer GlogWriter) Write(data []byte) (n int, err error)

Write implements the io.Writer interface.

type WrapFunc

type WrapFunc func(string, ...interface{}) string

WrapFunc take the param the same as glog.Infof, and return string.

type Wrapper

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

Wrapper use WrapFunc to handle the log message before send it to glog. Can be use as:

var handler blog.WrapFunc = func(format string, args ...interface{}) string {
    src := fmt.Sprintf(format, args...)
    dst := regexp.MustCompile("boy").ReplaceAllString(src, "man")
}
blog.Wrapper(handler).V(2).Info("hello boy")

And it will flush as:

I0104 09:44:27.796409   16233 blog.go:21] hello man

func Wrap

func Wrap(handler WrapFunc) *Wrapper

Wrap Wrapper function

func (*Wrapper) Error

func (w *Wrapper) Error(format string, args ...interface{})

Error implementation

func (*Wrapper) Fatal

func (w *Wrapper) Fatal(format string, args ...interface{})

Fatal implementation

func (*Wrapper) Info

func (w *Wrapper) Info(format string, args ...interface{})

Info implementation

func (*Wrapper) V

func (w *Wrapper) V(level glog.Level) *Wrapper

V implementation

func (*Wrapper) Warn

func (w *Wrapper) Warn(format string, args ...interface{})

Warn implementation

Directories

Path Synopsis
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.
Package glog implements logging analogous to the Google-internal C++ INFO/ERROR/V setup.

Jump to

Keyboard shortcuts

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