Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StacktraceEncoder is not support? #1490

Open
yyle88 opened this issue Mar 6, 2025 · 0 comments
Open

StacktraceEncoder is not support? #1490

yyle88 opened this issue Mar 6, 2025 · 0 comments

Comments

@yyle88
Copy link

yyle88 commented Mar 6, 2025

Describe the bug
code:

package M我勒个擦

import (
	"testing"

	"go.uber.org/zap"
)

func TestAbc(t *testing.T) {
	// 自定义 zap 配置
	config := zap.NewDevelopmentConfig()

	// 创建 logger
	logger, err := config.Build(zap.AddStacktrace(zap.PanicLevel)) // 在 Panic 级别添加堆栈
	if err != nil {
		t.Fatalf("failed to build logger: %v", err)
	}
	defer logger.Sync()

	funcName(logger)
}

func funcName(log *zap.Logger) {
	defer func() {
		recover()
	}()
	log.Panic("expect TRUE while got FALSE")
}

To Reproduce
run the test code.

Expected behavior
output is:

GOROOT=/opt/homebrew/opt/go/libexec #gosetup
GOPATH=/Users/yyle88/go #gosetup
/opt/homebrew/opt/go/libexec/bin/go test -c -o /Users/yyle88/Library/Caches/JetBrains/GoLand2025.1/tmp/GoLand/___T_test_go.test github.com/yyle88/zaplog/X我勒个擦/M我勒个擦 #gosetup
/opt/homebrew/opt/go/libexec/bin/go tool test2json -t /Users/yyle88/Library/Caches/JetBrains/GoLand2025.1/tmp/GoLand/___T_test_go.test -test.v=test2json -test.paniconexit0 -test.run ^\QTestAbc\E$ #gosetup
=== RUN   TestAbc
2025-03-07T00:14:03.714+0700	PANIC	M我勒个擦/T哈哈哈_test.go:27	expect TRUE while got FALSE
github.com/yyle88/zaplog/X%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6/M%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6.funcName
	/Users/yyle88/go-projects/open/zaplog/X我勒个擦/M我勒个擦/T哈哈哈_test.go:27
github.com/yyle88/zaplog/X%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6/M%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6.TestAbc
	/Users/yyle88/go-projects/open/zaplog/X我勒个擦/M我勒个擦/T哈哈哈_test.go:20
testing.tRunner
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1792
--- PASS: TestAbc (0.00s)
PASS

进程 已完成,退出代码为 0

Additional context
why the out put contains the

X%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6/M%e6%88%91%e5%8b%92%e4%b8%aa%e6%93%a6

I know it is better not use no-ascii code in the package path.

while as you see. my english is just so so.

so I really need the chinese package path in my project. so can you please provide a stack-trace-encoder set func.

thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant