forked from TrueCloudLab/certificates
Verbose debug logging
This commit is contained in:
parent
f140874e42
commit
860baeb1c5
1 changed files with 8 additions and 0 deletions
|
@ -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...)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue