зеркало из https://github.com/mozilla/doorman.git
Add dedicated logger for request authorizations
This commit is contained in:
Родитель
dafea2ba81
Коммит
3e6aa4a893
|
@ -66,7 +66,7 @@ func allowedHandler(c *gin.Context) {
|
|||
err := doorman.IsAllowed(origin, &accessRequest)
|
||||
allowed := (err == nil)
|
||||
|
||||
log.WithFields(
|
||||
authzLog.WithFields(
|
||||
log.Fields{
|
||||
"allowed": allowed,
|
||||
"subject": accessRequest.Subject,
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package doorman
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.mozilla.org/mozlogrus"
|
||||
"os"
|
||||
)
|
||||
|
||||
var authzLog logrus.Logger
|
||||
|
||||
func init() {
|
||||
authzLog = logrus.Logger{
|
||||
Out: os.Stdout,
|
||||
Formatter: &mozlogrus.MozLogFormatter{LoggerName: "iam", Type: "request.authorization"},
|
||||
Hooks: make(logrus.LevelHooks),
|
||||
Level: logrus.InfoLevel,
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче