SecretNetwork
SecretNetwork copied to clipboard
'secretd export' prints info logs to STDOUT not STDERR when initializing the enclave.
Because the JSON is also sent to STDOUT it results in invalid formatting when using a shell redirect.
Think these are the lines in question:
https://github.com/scrtlabs/SecretNetwork/blob/master/cosmwasm/packages/sgx-vm/src/enclave.rs#L106 https://github.com/scrtlabs/SecretNetwork/blob/master/cosmwasm/packages/sgx-vm/src/seed.rs#L103 (also line 112)
Sorry, I'd normally attach a PR for this because I know it's a super-simple fix, but I don't know Rust.
That is kind of annoying indeed.
I'm not sure what's the right approach here. iirc cosmos-sdk output defaults to stderr, but we changed it in secretd
to stdout. Maybe we should change it back to stderr?
Another option is to redirect enclave logs to stderr, but I'm not sure this is a good idea because iirc all other tendermint block execution logs are going to stdout.
What do you think? @assafmo @reuvenpo
I think that all those various logs should be going to stderr, and never to stdout. In rust the change is simple - change println!
to eprintln!
. In Go change calls to the various fmt.*Print*
functions with just println()
(not from the fmt
package).
The only things going to stdout
should be main outputs of commands, such as tx jsons, query results, etc.
Yes logs should go to stderr
Also, now 'secretd export' is now always exports the json into a file https://github.com/scrtlabs/cosmos-sdk/pull/185
Yep ^ so closing this