2024-10-15 20:05:52 +08:00
|
|
|
package mylogger_test
|
|
|
|
|
2024-10-21 15:54:36 +08:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"path"
|
|
|
|
"runtime"
|
|
|
|
)
|
2024-10-15 20:05:52 +08:00
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-10-21 15:54:36 +08:00
|
|
|
func getInfo(skip int) (funcName, fileName string, lineNo int) {
|
|
|
|
pc, file, lineNo, ok := runtime.Caller(skip)
|
|
|
|
if !ok {
|
|
|
|
fmt.Printf("runtime.Caller() failed\n")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
funcName = runtime.FunForPC(pc).Name()
|
|
|
|
fileName = path.Base(file)
|
|
|
|
return
|
2024-10-15 20:05:52 +08:00
|
|
|
}
|