mirror of
https://github.com/mudler/luet.git
synced 2025-09-13 13:50:26 +00:00
Add file/line/function to debug messages
This commit is contained in:
@@ -3,7 +3,9 @@ package logger
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
. "github.com/mudler/luet/pkg/config"
|
. "github.com/mudler/luet/pkg/config"
|
||||||
@@ -228,6 +230,11 @@ func Warning(mess ...interface{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Debug(mess ...interface{}) {
|
func Debug(mess ...interface{}) {
|
||||||
|
pc, file, line, ok := runtime.Caller(1)
|
||||||
|
if ok {
|
||||||
|
mess = append([]interface{}{fmt.Sprintf("DEBUG (%s:#%d:%v)",
|
||||||
|
path.Base(file), line, runtime.FuncForPC(pc).Name())}, mess...)
|
||||||
|
}
|
||||||
msg("debug", false, mess...)
|
msg("debug", false, mess...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user