From cf2b1511163d8ba6641fef6af12da62a1db736cd Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 24 Feb 2017 19:08:02 +0000 Subject: wallet: avoid pre-log-init spew on --version --- src/wallet/wallet_args.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/wallet/wallet_args.cpp b/src/wallet/wallet_args.cpp index db2042894..d2cda8700 100644 --- a/src/wallet/wallet_args.cpp +++ b/src/wallet/wallet_args.cpp @@ -106,10 +106,21 @@ namespace wallet_args po::options_description desc_all; desc_all.add(desc_general).add(desc_params); po::variables_map vm; + std::string log_path; bool r = command_line::handle_error_helper(desc_all, [&]() { po::store(command_line::parse_command_line(argc, argv, desc_general, true), vm); + if (command_line::has_arg(vm, arg_log_file)) + log_path = command_line::get_arg(vm, arg_log_file); + else + log_path = mlog_get_default_log_path("monero-wallet-cli.log"); + mlog_configure(log_path, log_to_console); + if (command_line::has_arg(vm, arg_log_level)) + { + mlog_set_log(command_line::get_arg(vm, arg_log_level).c_str()); + } + if (command_line::get_arg(vm, command_line::arg_help)) { tools::msg_writer() << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")"; @@ -134,17 +145,6 @@ namespace wallet_args if(command_line::has_arg(vm, arg_max_concurrency)) tools::set_max_concurrency(command_line::get_arg(vm, arg_max_concurrency)); - std::string log_path; - if (!vm["log-file"].defaulted()) - log_path = command_line::get_arg(vm, arg_log_file); - else - log_path = mlog_get_default_log_path("monero-wallet-cli.log"); - mlog_configure(log_path, log_to_console); - if (!vm["log-level"].defaulted()) - { - mlog_set_log(command_line::get_arg(vm, arg_log_level).c_str()); - } - tools::scoped_message_writer(epee::console_color_white, true) << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")"; if (!vm["log-level"].defaulted()) -- cgit v1.2.3 From 2b188151d4230252bbeac8ae1d9e8e6b8a8c4a38 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 24 Feb 2017 19:08:20 +0000 Subject: daemon: avoid pre-log-init spew on creating directories --- src/daemon/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index 8afdb08d8..19dd02171 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -168,7 +168,6 @@ int main(int argc, char const * argv[]) // Create data dir if it doesn't exist boost::filesystem::path data_dir = boost::filesystem::absolute( command_line::get_arg(vm, data_dir_arg)); - tools::create_directories_if_necessary(data_dir.string()); // FIXME: not sure on windows implementation default, needs further review //bf::path relative_path_base = daemonizer::get_relative_path_base(vm); @@ -216,6 +215,9 @@ int main(int argc, char const * argv[]) mlog_set_log(command_line::get_arg(vm, daemon_args::arg_log_level).c_str()); } + // after logs initialized + tools::create_directories_if_necessary(data_dir.string()); + // If there are positional options, we're running a daemon command { auto command = command_line::get_arg(vm, daemon_args::arg_command); -- cgit v1.2.3