EOSIO / eos

An open source smart contract platform
https://developers.eos.io/manuals/eos
MIT License
11.27k stars 3.6k forks source link

print function not working #6288

Closed treasersimplifies closed 5 years ago

treasersimplifies commented 5 years ago

testing codes:

#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
using namespace eosio;
class hello : public contract {
  public:
      using contract::contract;

      [[eosio::action]]
      void hi( account_name user, account_name words) {
        require_auth( user );
        print( "Hello, myfirst smc, ", name{user},", ", name{words});
      }
};
EOSIO_ABI( hello, (hi))

when I run the following cmd in my shell:

treaser$ cleos set contract testhero /DIR/EOScontracts/hello -p testhero
Reading WASM from /DIR/EOScontracts/hello/hello.wasm...
Publishing contract...
executed transaction: 00c46dfc2ccdc783d756c1862a838061b1acf24526b3ac1f14caaf3c9f1bc2e2  1600 bytes  462 us
#         eosio <= eosio::setcode               {"account":"testhero","vmtype":0,"vmversion":0,"code":"0061736d0100000001330a60037f7e7e0060027f7f006...
#         eosio <= eosio::setabi                {"account":"testhero","abi":"0e656f73696f3a3a6162692f312e30000102686900020475736572046e616d6505776f7...
warning: transaction executed locally, but may not be confirmed by the network yet         ]
treaser$ cleos push action testhero hi '["testhero","testhero"]' -p testhero
executed transaction: 8ec64ae8533a7976b3bcc1014c93e320210cb5903ef02d59990a4f392529d567  112 bytes  200 us
#      testhero <= testhero::hi                 {"user":"testhero","words":"testhero"}
warning: transaction executed locally, but may not be confirmed by the network yet         ] 

no output from print function.I don't know where is wrong.I have tried with many smart contracts, and print function is not working in all of them. And the above test hello-world program used to have print output initially when I use EOS development environment not the current production environment.

conr2d commented 5 years ago

Have you run nodeos with --contracts-console option? (or you can add contracts-console = true in your config.ini for nodeos)

treasersimplifies commented 5 years ago

Have you run nodeos with --contracts-console option? (or you can add contracts-console = true in your config.ini for nodeos)

How silly I am ! It works, thank you !

treasersimplifies commented 5 years ago

Wait... a new problem appear: when I use print("\n"); the code behind it didn't work any more.

damianoazzolini commented 5 years ago

Look at #5647

brianjohnson5972 commented 5 years ago

It sounds like your problem is solved. Next time when you run into a problem, start with https://eosio.stackexchange.com/ to get help. GitHub issues should only be made once it is determined that there is an actual problem in the software.

zzy9 commented 5 years ago

听起来你的问题已经解决了。下次遇到问题时,请从https://eosio.stackexchange.com/开始获取帮助。只有在确定软件中存在实际问题后才能进行GitHub问题。

It sounds like your problem is solved. Next time when you run into a problem, start with https://eosio.stackexchange.com/ to get help. GitHub issues should only be made once it is determined that there is an actual problem in the software.

v1.7.4 has add contracts-console = true in config.ini, but still do not print log in nodeos

zzy9 commented 5 years ago

Have you run nodeos with --contracts-console option? (or you can add contracts-console = true in your config.ini for nodeos)

v1.7.4 has add contracts-console = true in config.ini, but still do not print log in nodeos