Closed jantytgat closed 3 years ago
agreed. shouldn't be tied to usage of the library. will take a look
@jantytgat check out this branch use_hclog_instead_oflog.Printf
Usage would be client.setLogLevel("WARN")
to turn off almost all logs
Code is still incomplete: requires a lot of Printf to be converted to key, value format of hclog
@dheerajng @giorgos-nikolopoulos comments please?
Hi @chiradeep ,
Thanks for the quick reply, here are my first remarks:
I just looked at the documentation for hclog, and you can set the Level to Off, so this should disable all logging, which is good!
I think it is a big plus that the output of any logs is converted to structured logging.
Biggest downside I can see right now is that you are adding an additional external dependency, but on the other hand it is way better than having to add if-statements everywhere to enable/disable logs!
I will have a look at the code itself later today!
LGTM
I would suggest adding a parameter in NitroParams to set the log level through the NewNitroClientFromParams
LGTM. Minor comments are provided on the commit.
Fixed by #51
From what I understand, the go-nitro package is outputting DEBUG and TRACE level messages to the console in order to comply with Terraform guidelines for providers.
Is it possible to implement a parameter for the NitroClient to indicate whether or not to output these logs while performing operations. I don't mind if the default value would be set to true, as not to change the current behaviour.
This would also allow me to define the parameter specifically for the client, without having to call
log.SetOutput(ioutil.Discard)
for the complete program.