Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parse methods with central log instance #7141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nettnikl
Copy link

@nettnikl nettnikl commented Aug 6, 2024

  • Do only one thing
  • Non breaking API changes
  • Tested (works as far as i can tell)

What did this pull request do?

Added additional methods that include a logger as parameter, so internal methods can pass a the logger from the config though.

User Case Description

When i use gorm, i get logs like this:

2024/08/06 20:08:59 /project/internal/http_server/http.go:34
[error] invalid field found for struct wishes/internal/model.Wish's field Owner: define a valid foreign key for relations or implement the Valuer/Scanner interface

Currently, i need to do something like this.

import "io/gorm/logger"
var g *gorm.DB
logger.Default = g.Logger

To get gorm to use the central logger (this is the same (unrelated) error, but in the format i specified for my logs):

19:32:47 ERR ../../go/pkg/mod/gorm.io/[email protected]/schema/schema.go:334 > invalid field found for struct wishes/internal/model.Wish's field Owner: define a valid foreign key for relations or implement the Valuer/Scanner interface type=gorm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant