mirror of
https://github.com/monero-project/monero.git
synced 2025-08-02 07:46:10 -04:00
mlog: --max-log-files to set the max number of rotated log files
This commit is contained in:
parent
8a7b3ff138
commit
63d0ab09b5
5 changed files with 63 additions and 5 deletions
|
@ -72,6 +72,11 @@ namespace daemon_args
|
|||
, "Specify maximum log file size [B]"
|
||||
, MAX_LOG_FILE_SIZE
|
||||
};
|
||||
const command_line::arg_descriptor<std::size_t> arg_max_log_files = {
|
||||
"max-log-files"
|
||||
, "Specify maximum number of rotated log files to be saved (no limit by setting to 0)"
|
||||
, MAX_LOG_FILES
|
||||
};
|
||||
const command_line::arg_descriptor<std::string> arg_log_level = {
|
||||
"log-level"
|
||||
, ""
|
||||
|
|
|
@ -84,6 +84,7 @@ int main(int argc, char const * argv[])
|
|||
command_line::add_arg(core_settings, daemon_args::arg_log_file);
|
||||
command_line::add_arg(core_settings, daemon_args::arg_log_level);
|
||||
command_line::add_arg(core_settings, daemon_args::arg_max_log_file_size);
|
||||
command_line::add_arg(core_settings, daemon_args::arg_max_log_files);
|
||||
command_line::add_arg(core_settings, daemon_args::arg_max_concurrency);
|
||||
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_ip);
|
||||
command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_port);
|
||||
|
@ -203,7 +204,7 @@ int main(int argc, char const * argv[])
|
|||
if (!command_line::is_arg_defaulted(vm, daemon_args::arg_log_file))
|
||||
log_file_path = command_line::get_arg(vm, daemon_args::arg_log_file);
|
||||
log_file_path = bf::absolute(log_file_path, relative_path_base);
|
||||
mlog_configure(log_file_path.string(), true, command_line::get_arg(vm, daemon_args::arg_max_log_file_size));
|
||||
mlog_configure(log_file_path.string(), true, command_line::get_arg(vm, daemon_args::arg_max_log_file_size), command_line::get_arg(vm, daemon_args::arg_max_log_files));
|
||||
|
||||
// Set log level
|
||||
if (!command_line::is_arg_defaulted(vm, daemon_args::arg_log_level))
|
||||
|
|
|
@ -101,6 +101,7 @@ namespace wallet_args
|
|||
|
||||
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
|
||||
const command_line::arg_descriptor<std::size_t> arg_max_log_file_size = {"max-log-file-size", "Specify maximum log file size [B]", MAX_LOG_FILE_SIZE};
|
||||
const command_line::arg_descriptor<std::size_t> arg_max_log_files = {"max-log-files", "Specify maximum number of rotated log files to be saved (no limit by setting to 0)", MAX_LOG_FILES};
|
||||
const command_line::arg_descriptor<uint32_t> arg_max_concurrency = {"max-concurrency", wallet_args::tr("Max number of threads to use for a parallel job"), DEFAULT_MAX_CONCURRENCY};
|
||||
const command_line::arg_descriptor<std::string> arg_log_file = {"log-file", wallet_args::tr("Specify log file"), ""};
|
||||
const command_line::arg_descriptor<std::string> arg_config_file = {"config-file", wallet_args::tr("Config file"), "", true};
|
||||
|
@ -119,6 +120,7 @@ namespace wallet_args
|
|||
command_line::add_arg(desc_params, arg_log_file);
|
||||
command_line::add_arg(desc_params, arg_log_level);
|
||||
command_line::add_arg(desc_params, arg_max_log_file_size);
|
||||
command_line::add_arg(desc_params, arg_max_log_files);
|
||||
command_line::add_arg(desc_params, arg_max_concurrency);
|
||||
command_line::add_arg(desc_params, arg_config_file);
|
||||
|
||||
|
@ -180,7 +182,7 @@ namespace wallet_args
|
|||
log_path = command_line::get_arg(vm, arg_log_file);
|
||||
else
|
||||
log_path = mlog_get_default_log_path(default_log_name);
|
||||
mlog_configure(log_path, log_to_console, command_line::get_arg(vm, arg_max_log_file_size));
|
||||
mlog_configure(log_path, log_to_console, command_line::get_arg(vm, arg_max_log_file_size), command_line::get_arg(vm, arg_max_log_files));
|
||||
if (!command_line::is_arg_defaulted(vm, arg_log_level))
|
||||
{
|
||||
mlog_set_log(command_line::get_arg(vm, arg_log_level).c_str());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue