Skip to content

Commit

Permalink
Update context user for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ribice committed Nov 10, 2018
1 parent d7b80ef commit ed514fe
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/utl/zlog/zlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"os"

"github.com/labstack/echo"
"github.com/ribice/chisk/model"

"github.com/rs/zerolog"
)
Expand All @@ -31,9 +30,9 @@ func (z *Log) Log(ctx echo.Context, source, msg string, err error, params map[st

params["source"] = source

if user, ok := ctx.Get("au").(*chisk.AuthUser); ok {
params["id"] = user.ID
params["username"] = user.DisplayName
if id, ok := ctx.Get("id").(int); ok {
params["id"] = id
params["user"] = ctx.Get("username").(string)
}

if err != nil {
Expand Down

0 comments on commit ed514fe

Please sign in to comment.