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

Support for quiet operations #703

Closed
servernoj opened this issue Feb 21, 2024 · 4 comments
Closed

Support for quiet operations #703

servernoj opened this issue Feb 21, 2024 · 4 comments

Comments

@servernoj
Copy link

I run goose (for migrate up) as part of the dockertest setup, where a new container gets created and purged for every integration test.

I have about 10 migrations (so far), so I see the entire list printed for every test to acknowledge successful migration.

Would it be possible to introduce an option to enable quiet operations for situations like mine?

Thank you.

@mfridman
Copy link
Collaborator

Absolutely. I thought that was the case already. If you use the library, you can set a disabled logger, or if using the CLI if you don't supply the verbose flag, it doesn't print anything.

If that's not the case, I could see us introducing –-quiet flag or equivalent.

@servernoj
Copy link
Author

To clarify, I am using the library because some of my migrations are Go-flavored. I'm not sure I understand how to disable logging that is buried like in these two examples:

Based on how the logger is initialized in

goose/log.go

Line 7 in 76946cc

var log Logger = &stdLogger{}
I don't see a way to disable it via options passed to Run() method

Thank you

@mfridman
Copy link
Collaborator

mfridman commented Feb 22, 2024

All of the log identifiers are for the "custom" logger and not the standard lib one.

In #383 we added a noop logger, so something like this might work:

goose.SetLogger(goose.NopLogger())

Or, if you use goose.NewProvider and call methods, they should all be "quiet" by default unless you enable verbose.

@servernoj
Copy link
Author

Thank you, the approach with

goose.SetLogger(goose.NopLogger())

helped. I am closing the issue.

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

No branches or pull requests

2 participants