What is the best practice for logging in pallets? Is there any overhead leaving them in at a debug/trace level? Or should we never use them outside of development?
Substrate and Polkadot Stack Exchange is a question and answer site for developers building blockchains with the Substrate SDK. It only takes a minute to sign up.Sign up to join this community
Generally, it is recommended to avoid logging inside the runtime This can lead to some issues, a few I can think of are:
Refer to the Debug Section - Substrate docs for more info.
In a production environment, it is recommended to use Errors and Events to provide information on the internal behavior of the call within a pallet.
Here’s an answer to a different question that could also help.
You abosultely can log in runtime.
No need to worry about the WASM. Just use it like you are developing a Rust program.
You can enable this feature while building the runtime release. It will disable the log in the WASM.
You can still see the log by not enable this feature in the binary build.