1
  1. I want to get Debug Information.
  2. I implemented this code,but I can not get.
  3. Please tell me how can I get Debug Infomation.
        #[ink(message)]
        fn set_test_data(&mut self, value: String) {
            ink_core::env::println(value);
            self.test_data.set(value);
        }
Michael
  • 41,989
  • 11
  • 82
  • 128
s.Takahashi
  • 469
  • 4
  • 15
  • This `println` should show up in your console when you execute this function. Make sure that you are submitting this as a real transaction, not using the RPC. – Shawn Tabrizi Aug 24 '20 at 13:51
  • thank you for your answer. I am trying below, but Is this "real transaction"? 1.I execute substrate by the command "substrate --dev".And I upload & deploy this "Contract". 2.I call this function using "send a transaction" of "Call a Contract" menu on "Polkadot/Substrate Portal". – s.Takahashi Aug 24 '20 at 22:33
  • `ink_core::env::println(value);` is now `ink_env::env::println(value);` – Squirrel Jul 20 '21 at 14:15
  • ink_env::debug_println(value); actually – True Jul 20 '21 at 16:13

2 Answers2

2

Those error messages are printed to the console. Please note that you need to supply the following command line arguments to your node in order to make this happen:

  1. --dev: Use the dev chain spec. You should already be using that.
  2. -lruntime=debug: Increase the log level for runtime generated messages.
Alexander Theißen
  • 3,799
  • 4
  • 28
  • 35
0

It's now in the ink_env crate:

ink_env::debug_println!("{}", "Hello log");

The FAQ entry on this is here:

https://paritytech.github.io/ink-docs/faq/#how-do-i-print-something-to-the-console-from-the-runtime

Squirrel
  • 1,189
  • 12
  • 15