Error handling in go, which file and line?

huangapple go评论94阅读模式
英文:

Error handling in go, which file and line?

问题

我没有找到更好的方法来以长格式显示错误详细信息。

log.SetFlags(log.Llongfile)

我特别关注错误发生的文件和行号。有没有一种方法可以在整个应用程序范围内设置长格式,而不是在每个函数中添加?

英文:

I did not find a better way to show error details in long form.

log.SetFlags(log.Llongfile)

I am particularly interested which file and line error happened. Is it any way to set long format application wide rather than add to every function?

答案1

得分: 0

你可能想考虑使用gin来监视并告诉你构建后发生错误的位置。

英文:

You might want to consider gin to watch and tells you where errors happened after build.

huangapple
  • 本文由 发表于 2016年10月26日 04:15:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/40248930.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定