pass logger ctx under key 'l'
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
leo 2023-04-19 05:18:01 +02:00
parent 608b0952b2
commit c6378d7dd3
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ
2 changed files with 4 additions and 4 deletions

@ -197,7 +197,7 @@ func SigninPost(client *ent.Client) echo.HandlerFunc {
return c.Redirect(302, "/signin")
}
ctx := context.WithValue(context.Background(), "logger", log)
ctx := context.WithValue(context.Background(), "l", log)
if usr, err := moduser.QueryUser(ctx, client, username); err == nil {
log.Info("queried user:", &usr.ID)
@ -300,7 +300,7 @@ func SignupPost(client *ent.Client) echo.HandlerFunc {
username = uname
if passwd := c.Request().FormValue("password"); passwd != "" {
ctx := context.WithValue(context.Background(), "logger", log)
ctx := context.WithValue(context.Background(), "l", log)
u, err := moduser.CreateUser(ctx, client, username, passwd)
if err != nil {

@ -11,7 +11,7 @@ import (
// CreateUser adds a user entry to the database.
func CreateUser(ctx context.Context, client *ent.Client, username, password string) (*ent.User, error) {
log := ctx.Value("logger").(*slogging.Logger)
log := ctx.Value("l").(*slogging.Logger)
u, err := client.User.
Create().
@ -29,7 +29,7 @@ func CreateUser(ctx context.Context, client *ent.Client, username, password stri
}
func QueryUser(ctx context.Context, client *ent.Client, username string) (*ent.User, error) {
log := ctx.Value("logger").(*slogging.Logger)
log := ctx.Value("l").(*slogging.Logger)
u, err := client.User.
Query().