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

[Feat] 在所有出错的地方打印error日志 #1062

Open
RikaCelery opened this issue Nov 10, 2024 · 2 comments
Open

[Feat] 在所有出错的地方打印error日志 #1062

RikaCelery opened this issue Nov 10, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@RikaCelery
Copy link

很多插件的处理方式为

if err != nil {
	ctx.SendChain(message.Text("ERROR: ", err))
	return
}

在没有堆栈信息的时候不好调试错误,希望改为如下形式

if err != nil {
	log.Error("<插件名称>",err)
        ctx.SendChain(message.Text("ERROR: ", err))
	return
}
@EatHatsuneShallots
Copy link
Contributor

貌似可以添加一个新 API:ctx.SendErrorMesssge

@fumiama
Copy link
Member

fumiama commented Nov 10, 2024

可以加到ctxext。在控制台打印error和直接发送error效果相同,只要你把每个error的位置搞清楚肯定能知道哪里出了问题。

@fumiama fumiama added enhancement New feature or request help wanted Extra attention is needed labels Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants