Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log console output during replay to file #985 #1355

Merged
merged 3 commits into from
Oct 2, 2018

Conversation

cogutvalera
Copy link
Member

PR for #985 "Log console output during replay to file"

bump fc and changed (std::cerr) to (ilog) in application.cpp and witness.cpp

}
if( modified_genesis )
{
std::cerr << "WARNING: GENESIS WAS MODIFIED, YOUR CHAIN ID MAY BE DIFFERENT\n";
ilog("WARNING: GENESIS WAS MODIFIED, YOUR CHAIN ID MAY BE DIFFERENT\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use wlog here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sure ! Thanks !

@@ -982,16 +985,18 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti
try {
genesis_state = fc::json::from_file(genesis_out).as<genesis_state_type>( 20 );
} catch(const fc::exception& e) {
std::cerr << "Unable to parse existing genesis file:\n" << e.to_string()
<< "\nWould you like to replace it? [y/N] ";
ilog(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prompts for user input, please change back to original.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sure ! Thanks !

if( db.get_slot_at_time( fc::time_point::now() ) > 200 )
{
std::cerr << "Your genesis seems to have an old timestamp\n"
ilog("Your genesis seems to have an old timestamp\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to wlog.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sure ! Thanks !

}
if( _options->count("dbg-init-key") )
{
std::string init_key = _options->at( "dbg-init-key" ).as<string>();
FC_ASSERT( genesis.initial_witness_candidates.size() >= genesis.initial_active_witnesses );
set_dbg_init_key( genesis, init_key );
modified_genesis = true;
std::cerr << "Set init witness key to " << init_key << "\n";
ilog("Set init witness key to ${init_key}\n", ("init_key", init_key));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\n is not needed in ilog.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in new commit. Thanks !

ilog(
"Used genesis timestamp: ${timestamp} (PLEASE RECORD THIS)\n",
("timestamp", genesis.initial_timestamp.to_iso_string())
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\n is not needed in ilog.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in new commit. Thanks !

@@ -989,9 +992,9 @@ void application::initialize(const fc::path& data_dir, const boost::program_opti
return;
}

std::cerr << "Updating genesis state in file " << genesis_out.generic_string() << "\n";
ilog("Updating genesis state in file ${genesis_out} \n", ("genesis_out", genesis_out.generic_string()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think here and below should be changed to ilog. @pmconrad what's your opinion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in new commit. Thanks !

if( db.get_slot_at_time( fc::time_point::now() ) > 200 )
{
std::cerr << "Your genesis seems to have an old timestamp\n"
wlog("Your genesis seems to have an old timestamp\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think having \n in the middle of a log message is a bit strange. What's your opinion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in new commit. Thanks !

}
if( modified_genesis )
{
std::cerr << "WARNING: GENESIS WAS MODIFIED, YOUR CHAIN ID MAY BE DIFFERENT\n";
wlog("WARNING: GENESIS WAS MODIFIED, YOUR CHAIN ID MAY BE DIFFERENT\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\n is not needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in new commit. Thanks !

Copy link
Contributor

@pmconrad pmconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pmconrad pmconrad merged commit 85ac4c0 into bitshares:develop Oct 2, 2018
@cogutvalera
Copy link
Member Author

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants