Skip to content

Commit

Permalink
feat: use context logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Stumble committed Sep 20, 2023
1 parent b4d87d8 commit e76185f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ as this combo.

Production versions:

+ sqlc: v2.1.8-wicked-fork
+ sqlc: v2.1.9-wicked-fork
+ dcache: v0.1.3
+ wgpx: v0.2.2

Expand Down
10 changes: 5 additions & 5 deletions internal/codegen/golang/templates/wpgx/queryCode.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
key := {{.CacheKey}}
err = q.cache.Invalidate(ctx, key)
if err != nil {
log.Error().Err(err).Msgf(
log.Ctx(ctx).Error().Err(err).Msgf(
"Failed to invalidate: %s", key)
anyErr = err
}
Expand Down Expand Up @@ -164,7 +164,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
key := {{.CacheKey}}
err = q.cache.Invalidate(ctx, key)
if err != nil {
log.Error().Err(err).Msgf(
log.Ctx(ctx).Error().Err(err).Msgf(
"Failed to invalidate: %s", key)
anyErr = err
}
Expand Down Expand Up @@ -198,7 +198,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
key := {{.CacheKey}}
err = q.cache.Invalidate(ctx, key)
if err != nil {
log.Error().Err(err).Msgf(
log.Ctx(ctx).Error().Err(err).Msgf(
"Failed to invalidate: %s", key)
anyErr = err
}
Expand Down Expand Up @@ -232,7 +232,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
key := {{.CacheKey}}
err = q.cache.Invalidate(ctx, key)
if err != nil {
log.Error().Err(err).Msgf(
log.Ctx(ctx).Error().Err(err).Msgf(
"Failed to invalidate: %s", key)
anyErr = err
}
Expand Down Expand Up @@ -266,7 +266,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{.Arg.Pair}} {{.Invalida
key := {{.CacheKey}}
err = q.cache.Invalidate(ctx, key)
if err != nil {
log.Error().Err(err).Msgf(
log.Ctx(ctx).Error().Err(err).Msgf(
"Failed to invalidate: %s", key)
anyErr = err
}
Expand Down

0 comments on commit e76185f

Please sign in to comment.