Permalink
Browse files

stop logging the same domain over and over

  • Loading branch information...
rybit committed Feb 14, 2018
1 parent bff20aa commit 519379d4efded0c8af10cd81109f620805cb43da
Showing with 3 additions and 6 deletions.
  1. +2 −2 api/token.go
  2. +1 −4 metering/record.go
@@ -98,7 +98,7 @@ func (a *API) ResourceOwnerPasswordGrant(ctx context.Context, w http.ResponseWri
if err != nil {
return err
}
metering.RecordLogin(r, "password", user.ID, instanceID)
metering.RecordLogin("password", user.ID, instanceID)
return sendJSON(w, http.StatusOK, token)
}
@@ -155,7 +155,7 @@ func (a *API) RefreshTokenGrant(ctx context.Context, w http.ResponseWriter, r *h
if err != nil {
return err
}
metering.RecordLogin(r, "token", user.ID, instanceID)
metering.RecordLogin("token", user.ID, instanceID)
return sendJSON(w, http.StatusOK, &AccessTokenResponse{
Token: tokenString,
TokenType: "bearer",
@@ -1,18 +1,15 @@
package metering
import (
"net/http"
uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
)
var logger = logrus.StandardLogger().WithField("metering", true)
func RecordLogin(r *http.Request, loginType string, userID, instanceID uuid.UUID) {
func RecordLogin(loginType string, userID, instanceID uuid.UUID) {
logger.WithFields(logrus.Fields{
"action": "login",
"domain": r.Host,
"login_method": loginType,
"instance_id": instanceID.String(),
"user_id": userID.String(),

0 comments on commit 519379d

Please sign in to comment.