Skip to content

Commit 5885aec

Browse files
author
Matt Rogers
committed
enable additional osin server error logging
1 parent 219a4e2 commit 5885aec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/oauthserver/osinserver/osinserver.go

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"path"
77

88
"github.com/RangelReale/osin"
9+
"github.com/golang/glog"
910

1011
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
1112
)
@@ -24,12 +25,23 @@ type Server struct {
2425
errorHandler ErrorHandler
2526
}
2627

28+
// Logger captures additional osin server errors
29+
type Logger struct {
30+
}
31+
32+
func (l Logger) Printf(format string, v ...interface{}) {
33+
if glog.V(2) {
34+
glog.ErrorDepth(3, fmt.Sprintf("osin: "+format, v...))
35+
}
36+
}
37+
2738
func New(config *osin.ServerConfig, storage osin.Storage, authorize AuthorizeHandler, access AccessHandler, errorHandler ErrorHandler) *Server {
2839
server := osin.NewServer(config, storage)
2940

3041
// Override tokengen to ensure we get valid length tokens
3142
server.AuthorizeTokenGen = TokenGen{}
3243
server.AccessTokenGen = TokenGen{}
44+
server.Logger = Logger{}
3345

3446
return &Server{
3547
config: config,

0 commit comments

Comments
 (0)