Skip to content

Commit ed514fe

Browse files
committed
Update context user for logging
1 parent d7b80ef commit ed514fe

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/utl/zlog/zlog.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"os"
55

66
"github.com/labstack/echo"
7-
"github.com/ribice/chisk/model"
87

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

3231
params["source"] = source
3332

34-
if user, ok := ctx.Get("au").(*chisk.AuthUser); ok {
35-
params["id"] = user.ID
36-
params["username"] = user.DisplayName
33+
if id, ok := ctx.Get("id").(int); ok {
34+
params["id"] = id
35+
params["user"] = ctx.Get("username").(string)
3736
}
3837

3938
if err != nil {

0 commit comments

Comments
 (0)