From 52b319bc00712da095ee4121b616be232b1e455b Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 20 Dec 2024 12:17:14 +0800 Subject: Refactor pprof labels and process desc (#32909) * Deprecate "gopid" in log, it is not useful and requires very hacky approach * Remove "git.Command.SetDescription" because it is not useful and only makes the logs too flexible --- modules/util/runtime.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 modules/util/runtime.go (limited to 'modules/util/runtime.go') diff --git a/modules/util/runtime.go b/modules/util/runtime.go new file mode 100644 index 0000000000..91ec3c869c --- /dev/null +++ b/modules/util/runtime.go @@ -0,0 +1,13 @@ +// Copyright 2024 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package util + +import "runtime" + +func CallerFuncName(skip int) string { + pc := make([]uintptr, 1) + runtime.Callers(skip+1, pc) + funcName := runtime.FuncForPC(pc[0]).Name() + return funcName +} -- cgit v1.2.3