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

Debug message when relying on default values #184

Closed
nicolasdscp opened this issue Jul 5, 2021 · 2 comments · Fixed by #185
Closed

Debug message when relying on default values #184

nicolasdscp opened this issue Jul 5, 2021 · 2 comments · Fixed by #185

Comments

@nicolasdscp
Copy link

nicolasdscp commented Jul 5, 2021

Hello,

I have a question/suggestion, here's the context:

At my work we want to display a message (in stdout for example) when the Parser uses the default value.

Example:

type A struct {
  B int `env:"ENV_B" envDefault:"1"`
} 

func main() {
  a := A{}
  env.Parse(&a)
} 

If ENV_B is not defined, the parser will assign 1 to a.B, so is there a proper way to log anything at this moment ?
Like a debug message eg:

failed to parse ENV_B, relying on system default variable's value: 1

And if not, could such a feature be implemented ?

Thanks in advance

@caarlos0
Copy link
Owner

caarlos0 commented Jul 8, 2021

something like #185 maybe?

@nicolasdscp
Copy link
Author

Yeah it's perfect !

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 a pull request may close this issue.

2 participants