package
Version:
v1.5.22
Opens a new window with list of versions in this module.
Published: Aug 11, 2021
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
CloseLogs will flush the logs in cache out.
InitLogs initializes logs the way we want for blog.
SetV set the logs output level in runtime.
GlogWriter serves as a bridge between the standard log package and the glog package.
Write implements the io.Writer interface.
const (
StderrLevelInfo StderrLevel = iota
StderrLevelWarning
StderrLevelError
StderrLevelNothing
)
WrapFunc take the param the same as glog.Infof, and return string.
type Wrapper struct {
Handler WrapFunc
}
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
Wrap get a Wrapper with given WrapFunc.
Error write the error log.
Fatal write the fatal log.
V specific the log level to print.
Source Files
¶
Directories
¶
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. |
Click to show internal directories.
Click to hide internal directories.