From 860baeb1c5707557468c0ae0913d61370ff9b8ad Mon Sep 17 00:00:00 2001 From: Brandon Weeks Date: Tue, 31 May 2022 15:47:10 -0700 Subject: [PATCH] Verbose debug logging --- acme/errors.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/acme/errors.go b/acme/errors.go index 05888c24..e9122aa1 100644 --- a/acme/errors.go +++ b/acme/errors.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" "net/http" + "os" + "runtime/debug" "github.com/pkg/errors" "github.com/smallstep/certificates/api/render" @@ -273,6 +275,8 @@ type Error struct { // NewError creates a new Error type. func NewError(pt ProblemType, msg string, args ...interface{}) *Error { + fmt.Fprintf(os.Stderr, msg+"\n", args...) + debug.PrintStack() return newError(pt, errors.Errorf(msg, args...)) } @@ -298,6 +302,8 @@ func newError(pt ProblemType, err error) *Error { // NewErrorISE creates a new ErrorServerInternalType Error. func NewErrorISE(msg string, args ...interface{}) *Error { + fmt.Fprintf(os.Stderr, msg+"\n", args...) + debug.PrintStack() return NewError(ErrorServerInternalType, msg, args...) } @@ -320,6 +326,8 @@ func WrapError(typ ProblemType, err error, msg string, args ...interface{}) *Err // WrapErrorISE shortcut to wrap an internal server error type. func WrapErrorISE(err error, msg string, args ...interface{}) *Error { + fmt.Fprintf(os.Stderr, msg+"\n", args...) + debug.PrintStack() return WrapError(ErrorServerInternalType, err, msg, args...) }