8 Star 9 Fork 4

gpress / gpress

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
Logger.go 862 Bytes
Copy Edit Web IDE Raw Blame History
springrain authored 2022-12-05 11:55 . 格式化代码
package main
import (
"fmt"
"log"
)
func init() {
// 设置默认的日志显示信息,显示文件和行号
// Set the default log display information, display file and line number.
log.SetFlags(log.Llongfile | log.LstdFlags)
}
// LogCallDepth 记录日志调用层级,用于定位到业务层代码
// Log Call Depth Record the log call level, used to locate the business layer code
var LogCallDepth = 4
// FuncLogError 记录error日志
// FuncLogError Record error log
var FuncLogError func(err error) = defaultLogError
// FuncLogPanic 记录panic日志,默认使用"ZormErrorLog"实现
// FuncLogPanic Record panic log, using "Zorm Error Log" by default
var FuncLogPanic func(err error) = defaultLogPanic
func defaultLogError(err error) {
log.Output(LogCallDepth, fmt.Sprintln(err))
}
func defaultLogPanic(err error) {
defaultLogError(err)
}
Go
1
https://gitee.com/gpress/gpress.git
git@gitee.com:gpress/gpress.git
gpress
gpress
gpress
master

Search