mirror of
https://github.com/mudler/luet.git
synced 2025-09-13 05:42:52 +00:00
Add file/line/function to debug messages
This commit is contained in:
@@ -3,7 +3,9 @@ package logger
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
. "github.com/mudler/luet/pkg/config"
|
||||
@@ -228,6 +230,11 @@ func Warning(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...)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user