diff options
author | warptangent <warptangent@inbox.com> | 2015-05-27 04:19:34 -0700 |
---|---|---|
committer | warptangent <warptangent@inbox.com> | 2015-05-28 03:52:19 -0700 |
commit | 10ff75e92e5e65e23579c038aff917e78b2f7964 (patch) | |
tree | 1788c0b127708df6c78beebdd2b5e4029ef7372f /src/daemon/main.cpp | |
parent | simplewallet: Update and add log options (diff) | |
download | monero-10ff75e92e5e65e23579c038aff917e78b2f7964.tar.xz |
daemon: Set log file default to use data dir
The log file previously used the default data dir even if --data-dir was
set to something else.
Document data dir and log file path.
Diffstat (limited to 'src/daemon/main.cpp')
-rw-r--r-- | src/daemon/main.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index 62b655ccd..b8f0b697b 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -155,6 +155,12 @@ int main(int argc, char const * argv[]) auto data_dir_arg = testnet_mode ? command_line::arg_testnet_data_dir : command_line::arg_data_dir; + // data_dir + // default: e.g. ~/.bitmonero/ or ~/.bitmonero/testnet + // if data-dir argument given: + // absolute path + // relative path: relative to cwd + // Create data dir if it doesn't exist boost::filesystem::path data_dir = boost::filesystem::absolute( command_line::get_arg(vm, data_dir_arg)); @@ -238,9 +244,18 @@ int main(int argc, char const * argv[]) } } + // log_file_path + // default: <data_dir>/<CRYPTONOTE_NAME>.log + // if log-file argument given: + // absolute path + // relative path: relative to data_dir + // Set log file { - bf::path log_file_path{bf::absolute(command_line::get_arg(vm, daemon_args::arg_log_file), relative_path_base)}; + bf::path log_file_path {data_dir / std::string(CRYPTONOTE_NAME ".log")}; + if (! vm["log-file"].defaulted()) + log_file_path = command_line::get_arg(vm, daemon_args::arg_log_file); + log_file_path = bf::absolute(log_file_path, relative_path_base); epee::log_space::log_singletone::add_logger( LOGGER_FILE |