package main
import (
"github.com/gogf/gf/frame/g"
)
func main() {
g.Log().Line().Println("this is the short file name with its line number")
g.Log().Line(true).Println("lone file name with line number")
}
执行后,终端输出结果为:
2019-05-23 09:22:58.141 glog_line.go:8: this is the short file name with its line number
2019-05-23 09:22:58.142 /Users/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/geg/os/glog/glog_line.go:9: lone file name with line number
package main
import (
"github.com/gogf/gf/frame/g"
)
func PrintLog(content string) {
g.Log().Skip(1).Line().Println("line number with skip:", content)
g.Log().Line().Println("line number without skip:", content)
}
func main() {
PrintLog("just test")
}
执行后,终端输出结果为:
2019-05-23 19:30:10.984 glog_line2.go:13: line number with skip: just test
2019-05-23 19:30:10.984 glog_line2.go:9: line number without skip: just test