uber-go/zap

Add an option to override stacktrace collection logic

開放

#514 建立於 2017年10月12日

 (5 則留言) (6 個反應) (0 位負責人)Go (1,448 個分叉)batch import
help wanted

倉庫指標

星標
 (22,391 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Stacktrace collection

While trying to implement an encoder that is compatible with GCP Stackdriver logging and also for GCP Stackdriver Error Reporting, I suspected that it's not working properly because the generated stacktrace is not compatible with what Error Reporting is expected.

The documentation says (https://cloud.google.com/error-reporting/docs/formatting-error-messages): Go: Must be the return value of runtime.Stack()

The code in go sources (cloud.google.com/go/errors/errors.go) shows that cloud.google.com/go/errors.(*Client).logInternal indeed calls runtime.Stack.

Unfortunately, the stack is grabbed by trackStacktrace in stracktrace.go, and there is apparently no other way around to provide the stracktrace.

Unless I'm missing something, we cannot provide the way the stacktrace is grabbed by zap

貢獻者指南