standardize commonly used attributes

Some commonly used at maal attributes have been encoded as consts with
convinience wrappers similar to those of semconv package from otel sdk.
Additionally some utils that can generate mutliple attributes were added.
This commit is contained in:
2024-05-16 13:45:13 +02:00
parent 6fb12e9e9d
commit ab5b70704d
8 changed files with 390 additions and 67 deletions

View File

@ -0,0 +1,13 @@
package code_location
type CodeLocation struct {
FilePath string
FuncName string
LineNumber int
ColumnNumber int
}
func FromStackTrace(...atDepth int) {
pc, file, line, _ := runtime.Caller(1 + skipLevelsInCallStack)
funcName := runtime.FuncForPC(pc).Name()
}