func (l *DefLog) getCallerInfo(level log.Level) string {
	if !metadata.IsCallerInfoEnabled(l.module, level) {
		return ""
	}
	const (
		MAXCALLERS = 6
		SKIPCALLERS      = 5
		NOTFOUND         = "n/a"
		DEFAULTLOGPREFIX = "log.(*Log)"
	)
	fpcs := make([]uintptr, MAXCALLERS)
	n := runtime.Callers(SKIPCALLERS, fpcs)
	if n == 0 {
		return fmt.Sprintf(callerInfoFormatter, NOTFOUND)
	}
	frames := runtime.CallersFrames(fpcs[:n])
	loggerFrameFound := false
	for f, more := frames.Next(); more; f, more = frames.Next() {
		_, fnName := filepath.Split(f.Function)
		if f.Func == nil || f.Function == "" {
			fnName = NOTFOUND  
		}
		if loggerFrameFound {
			return fmt.Sprintf(callerInfoFormatter, fnName)
		}
		if strings.HasPrefix(fnName, DEFAULTLOGPREFIX) {
			loggerFrameFound = true
			continue
		}
		return fmt.Sprintf(callerInfoFormatter, fnName)
	}
	return fmt.Sprintf(callerInfoFormatter, NOTFOUND)
}
getCallerInfo going through runtime caller frames to determine the caller of logger function by filtering
internal logging library functions.
package modlog
import (
	"fmt"
	"io"
	builtinlog "log"
	"os"
	"path/filepath"
	"runtime"
	"strings"
	"github.com/hyperledger/aries-framework-go/pkg/internal/common/logging/metadata"
	"github.com/hyperledger/aries-framework-go/spi/log"
)
const (
	logLevelFormatter   = "UTC %s-> %s "
	logPrefixFormatter  = " [%s] "
	callerInfoFormatter = "- %s "
)
func NewDefLog(module string) *DefLog {
	logger := builtinlog.New(os.Stdout, fmt.Sprintf(logPrefixFormatter, module),
		builtinlog.Ldate|builtinlog.Ltime|builtinlog.LUTC)
	return &DefLog{logger: logger, module: module}
}
type DefLog struct {
	logger *builtinlog.Logger
	module string
}
func (l *DefLog) Fatalf(format string, args ...interface{}) {
	l.logf(log.CRITICAL, format, args...)
	os.Exit(1)
}
func (l *DefLog) Panicf(format string, args ...interface{}) {
	l.logf(log.CRITICAL, format, args...)
	panic(fmt.Sprintf(format, args...))
}
func (l *DefLog) Debugf(format string, args ...interface{}) {
	l.logf(log.DEBUG, format, args...)
}
func (l *DefLog) Infof(format string, args ...interface{}) {
	l.logf(log.INFO, format, args...)
}
func (l *DefLog) Warnf(format string, args ...interface{}) {
	l.logf(log.WARNING, format, args...)
}
func (l *DefLog) Errorf(format string, args ...interface{}) {
	l.logf(log.ERROR, format, args...)
}
func (l *DefLog) SetOutput(output io.Writer) {
	l.logger.SetOutput(output)
}
func (l *DefLog) logf(level log.Level, format string, args ...interface{}) {
	const callDepth = 2
	customPrefix := fmt.Sprintf(logLevelFormatter, l.getCallerInfo(level), metadata.ParseString(level))
	err := l.logger.Output(callDepth, customPrefix+fmt.Sprintf(format, args...))
	if err != nil {
		fmt.Printf("error from logger.Output %v\n", err)  
	}
}