gitlab.com/evatix-go/core@v1.3.55/codestack/FileName.go (about)

     1  package codestack
     2  
     3  import (
     4  	"path/filepath"
     5  	"runtime"
     6  
     7  	"gitlab.com/evatix-go/core/constants"
     8  )
     9  
    10  func FileName(skipStack int) string {
    11  	_, file, _, isOkay := runtime.Caller(skipStack + defaultInternalSkip)
    12  
    13  	if !isOkay && file == "" {
    14  		return constants.EmptyString
    15  	}
    16  
    17  	_, fileName := filepath.Split(file)
    18  
    19  	return fileName
    20  }