1
0
mirror of https://github.com/beego/bee.git synced 2025-07-04 21:50:18 +00:00

Fixes the filename and lineNo in debug log message

This commit is contained in:
Faissal Elamraoui
2016-11-14 18:02:29 +01:00
committed by Faissal Elamraoui
parent c3c264ddb5
commit deacdaa667
9 changed files with 27 additions and 17 deletions

12
util.go
View File

@ -262,3 +262,15 @@ func IsDebugEnabled() bool {
debugMode := os.Getenv("DEBUG_ENABLED")
return map[string]bool{"1": true, "0": false}[debugMode]
}
// __FILE__ returns the file name in which the function was invoked
func __FILE__() string {
_, file, _, _ := runtime.Caller(1)
return file
}
// __LINE__ returns the line number at which the function was invoked
func __LINE__() int {
_, _, line, _ := runtime.Caller(1)
return line
}