goose icon indicating copy to clipboard operation
goose copied to clipboard

ParseSQLMigration doesn't respect `goose.SetLogger(...)` or `goose.WithNoColor(true)(nil)`

Open szymon opened this issue 1 year ago • 1 comments

Hi, if I call

goose.SetVerbose(true)
goose.WithNoColor(true)(nil)
goose.SetLogger(MyGooseLogger)

then goose.Up(...) will output logs from ParseSQLMigration using the standard logger, from "log" module, and then using MyGooseLogger it will print the operations on the database like: Begin transaction or Executing statement: create table xxx ...

szymon avatar Oct 10 '24 11:10 szymon

Curious, are you actually interested in output from debug parsing?

I believe this was always intended to be for developer debugging and less for "verbose output", so we could probably decouple this from the verbose option.

Also, we can't propagate the goose.Logger into this package because it'd cause an import cycle since goose itself imports the sqlparser package.

I've always want to add a separate EnableDebug which would control logging in the parser and leaving SetVerbose only for goose output.

mfridman avatar Oct 14 '24 18:10 mfridman