mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-20 08:06:18 +00:00
Collapse cascading log levels into LOG_ERRORS / LOG_EVENTS / LOG_DEBUG_TRACE.
This commit is contained in:
+9
-13
@@ -18,7 +18,8 @@ Some control over formatting will be provided at a later date.
|
|||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
# log.add_output = "logging event", "log name"
|
# log.add_output = "logging event", "log name"
|
||||||
|
|
||||||
log.add_output = "info", "rtorrent.log"
|
log.add_output = "errors", "rtorrent.log"
|
||||||
|
log.add_output = "events", "rtorrent.log"
|
||||||
|
|
||||||
log.add_output = "dht_all", "tracker.log"
|
log.add_output = "dht_all", "tracker.log"
|
||||||
log.add_output = "tracker_events", "tracker.log"
|
log.add_output = "tracker_events", "tracker.log"
|
||||||
@@ -31,21 +32,16 @@ Each log handle can be added to multiple different logging events.
|
|||||||
\subsection{Logging events}
|
\subsection{Logging events}
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
"critical"
|
"errors"
|
||||||
"error"
|
"events"
|
||||||
"warn"
|
"debug_trace"
|
||||||
"notice"
|
|
||||||
"info"
|
|
||||||
"debug"
|
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
The above events receive logging events from all the sub-groups
|
The above events are not cascading, so add both ``errors'' and
|
||||||
displayed below, and each event also reciving events from the event
|
``events'' to an output to receive both.
|
||||||
above in importance.
|
|
||||||
|
|
||||||
Thus some high-volume sub-group events such as ``tracker\_debug'' are
|
High-volume sub-group events such as ``tracker\_debug'' are not part
|
||||||
not part of ``debug'' and every ``warn'' event will receive events
|
of ``debug\_trace''.
|
||||||
from ``error'', ``critical''.
|
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
"connection_*"
|
"connection_*"
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ print = (cat, "Logging to ", (cfg.logfile))
|
|||||||
|
|
||||||
log.open_file = "log", (cfg.logfile)
|
log.open_file = "log", (cfg.logfile)
|
||||||
|
|
||||||
log.add_output = "info", "log"
|
log.add_output = "errors", "log"
|
||||||
|
log.add_output = "events", "log"
|
||||||
#log.add_output = "tracker_events", "log"
|
#log.add_output = "tracker_events", "log"
|
||||||
#log.add_output = "tracker_requests", "log"
|
#log.add_output = "tracker_requests", "log"
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,8 @@ rc.schedule2('watch_load', '11', '10', 'load.verbose=(cat, (cfg.watch), "load/*.
|
|||||||
-- Groups = connection_* dht_* peer_* rpc_* storage_* thread_* tracker_* torrent_*
|
-- Groups = connection_* dht_* peer_* rpc_* storage_* thread_* tracker_* torrent_*
|
||||||
rc.print('Logging to '..rc.cfg.logfile())
|
rc.print('Logging to '..rc.cfg.logfile())
|
||||||
rc.log.open_file('log', rc.cfg.logfile())
|
rc.log.open_file('log', rc.cfg.logfile())
|
||||||
rc.log.add_output('info', 'log')
|
rc.log.add_output('errors', 'log')
|
||||||
|
rc.log.add_output('events', 'log')
|
||||||
--rc.log.add_output('tracker_events', 'log')
|
--rc.log.add_output('tracker_events', 'log')
|
||||||
--rc.log.add_output('tracker_requests', 'log')
|
--rc.log.add_output('tracker_requests', 'log')
|
||||||
|
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ cmd_catch(rpc::target_type target, const torrent::Object& args) {
|
|||||||
try {
|
try {
|
||||||
return rpc::call_object(args, target);
|
return rpc::call_object(args, target);
|
||||||
} catch (torrent::input_error& e) {
|
} catch (torrent::input_error& e) {
|
||||||
lt_log_print(torrent::LOG_WARN, "Caught exception: '%s'.", e.what());
|
lt_log_print(torrent::LOG_ERRORS, "Caught exception: '%s'.", e.what());
|
||||||
return torrent::Object();
|
return torrent::Object();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ initialize_command_local() {
|
|||||||
CMD_ANY_VALUE_V ("pieces.sync.timeout.set", [](auto, auto& value) { return torrent::runtime::memory_manager()->set_timeout_sync(value); });
|
CMD_ANY_VALUE_V ("pieces.sync.timeout.set", [](auto, auto& value) { return torrent::runtime::memory_manager()->set_timeout_sync(value); });
|
||||||
CMD_ANY ("pieces.sync.timeout_safe", [](auto, auto) { return 0; });
|
CMD_ANY ("pieces.sync.timeout_safe", [](auto, auto) { return 0; });
|
||||||
CMD_ANY_VALUE_V ("pieces.sync.timeout_safe.set", [](auto, auto) {
|
CMD_ANY_VALUE_V ("pieces.sync.timeout_safe.set", [](auto, auto) {
|
||||||
lt_log_print(torrent::LOG_WARN, "pieces.sync.timeout_safe.set is no longer supported and does nothing.");
|
lt_log_print(torrent::LOG_ERRORS, "pieces.sync.timeout_safe.set is no longer supported and does nothing.");
|
||||||
});
|
});
|
||||||
CMD_ANY ("pieces.sync.queue_size", [](auto, auto) { return torrent::runtime::memory_manager()->sync_queue_block_count(); });
|
CMD_ANY ("pieces.sync.queue_size", [](auto, auto) { return torrent::runtime::memory_manager()->sync_queue_block_count(); });
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ apply_obsolete_encryption(const torrent::Object::list_type& args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lt_log_print(torrent::LOG_WARN, "Obsolete encryption options used, use 'handshake_{deny,allow,prefer,require}, stream_{deny,allow,prefer,require}' instead.");
|
lt_log_print(torrent::LOG_ERRORS, "Obsolete encryption options used, use 'handshake_{deny,allow,prefer,require}, stream_{deny,allow,prefer,require}' instead.");
|
||||||
|
|
||||||
torrent::runtime::network_config()->set_encryption_modes(handshake_mode, stream_mode);
|
torrent::runtime::network_config()->set_encryption_modes(handshake_mode, stream_mode);
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ initialize_command_tracker() {
|
|||||||
|
|
||||||
CMD2_ANY ("trackers.use_udp", [](auto, auto) { return true; });
|
CMD2_ANY ("trackers.use_udp", [](auto, auto) { return true; });
|
||||||
CMD2_ANY_VALUE_V ("trackers.use_udp.set", [](auto, auto) {
|
CMD2_ANY_VALUE_V ("trackers.use_udp.set", [](auto, auto) {
|
||||||
lt_log_print(torrent::LOG_ERROR, "trackers.use_udp.set is no longer supported", 0);
|
lt_log_print(torrent::LOG_ERRORS, "trackers.use_udp.set is no longer supported", 0);
|
||||||
})
|
})
|
||||||
|
|
||||||
CMD2_ANY_STRING_V ("dht.mode.set", [](auto, auto& str) { return control->dht_manager()->set_mode_by_user(str); });
|
CMD2_ANY_STRING_V ("dht.mode.set", [](auto, auto& str) { return control->dht_manager()->set_mode_by_user(str); });
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ DownloadFactory::receive_success() {
|
|||||||
libtorrent_resume_object = download_factory_load_stream((expand_path(m_uri) + ".libtorrent_resume").c_str(), &session_invalid);
|
libtorrent_resume_object = download_factory_load_stream((expand_path(m_uri) + ".libtorrent_resume").c_str(), &session_invalid);
|
||||||
|
|
||||||
if (session_invalid)
|
if (session_invalid)
|
||||||
lt_log_print(torrent::LOG_ERROR, "%s: %s", session_invalid_message, m_uri.c_str());
|
lt_log_print(torrent::LOG_ERRORS, "%s: %s", session_invalid_message, m_uri.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tracker_key;
|
uint32_t tracker_key;
|
||||||
@@ -313,7 +313,7 @@ DownloadFactory::receive_success() {
|
|||||||
} catch (const torrent::input_error& e) {
|
} catch (const torrent::input_error& e) {
|
||||||
std::string msg = std::string(session_invalid_message) + ": " + e.what();
|
std::string msg = std::string(session_invalid_message) + ": " + e.what();
|
||||||
|
|
||||||
lt_log_print(torrent::LOG_ERROR, "%s: %s", msg.c_str(), m_uri.c_str());
|
lt_log_print(torrent::LOG_ERRORS, "%s: %s", msg.c_str(), m_uri.c_str());
|
||||||
|
|
||||||
if (m_printLog)
|
if (m_printLog)
|
||||||
m_manager->push_log_std(msg + ": \"" + m_uri + "\"");
|
m_manager->push_log_std(msg + ": \"" + m_uri + "\"");
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ DownloadList::clear() {
|
|||||||
torrent::download_remove(*download->download());
|
torrent::download_remove(*download->download());
|
||||||
|
|
||||||
} catch (torrent::internal_error& e) {
|
} catch (torrent::internal_error& e) {
|
||||||
lt_log_print(torrent::LOG_ERROR, "DownloadList::clear() failed to close or remove download: %s", e.what());
|
lt_log_print(torrent::LOG_ERRORS, "DownloadList::clear() failed to close or remove download: %s", e.what());
|
||||||
error_count++;
|
error_count++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
+19
-18
@@ -152,10 +152,11 @@ main(int argc, char** argv) {
|
|||||||
|
|
||||||
SignalHandler::set_sigaction_handler(SIGBUS, &handle_sigbus);
|
SignalHandler::set_sigaction_handler(SIGBUS, &handle_sigbus);
|
||||||
|
|
||||||
torrent::log_add_group_output(torrent::LOG_NOTICE, "important");
|
torrent::log_add_group_output(torrent::LOG_ERRORS, "important");
|
||||||
torrent::log_add_group_output(torrent::LOG_DHT_ERROR, "important");
|
torrent::log_add_group_output(torrent::LOG_DHT_ERROR, "important");
|
||||||
|
|
||||||
torrent::log_add_group_output(torrent::LOG_INFO, "complete");
|
torrent::log_add_group_output(torrent::LOG_ERRORS, "complete");
|
||||||
|
torrent::log_add_group_output(torrent::LOG_EVENTS, "complete");
|
||||||
torrent::log_add_group_output(torrent::LOG_DHT_ERROR, "complete");
|
torrent::log_add_group_output(torrent::LOG_DHT_ERROR, "complete");
|
||||||
torrent::log_add_group_output(torrent::LOG_DHT_CONTROLLER, "complete");
|
torrent::log_add_group_output(torrent::LOG_DHT_CONTROLLER, "complete");
|
||||||
|
|
||||||
@@ -175,17 +176,17 @@ main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (OptionParser::has_flag('D', argc, argv)) {
|
if (OptionParser::has_flag('D', argc, argv)) {
|
||||||
rpc::call_command_set_value("method.use_deprecated.set", true);
|
rpc::call_command_set_value("method.use_deprecated.set", true);
|
||||||
lt_log_print(torrent::LOG_WARN, "Enabled deprecated commands.");
|
lt_log_print(torrent::LOG_ERRORS, "Enabled deprecated commands.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OptionParser::has_flag('I', argc, argv)) {
|
if (OptionParser::has_flag('I', argc, argv)) {
|
||||||
rpc::call_command_set_value("method.use_intermediate.set", 0);
|
rpc::call_command_set_value("method.use_intermediate.set", 0);
|
||||||
lt_log_print(torrent::LOG_WARN, "Disabled intermediate commands.");
|
lt_log_print(torrent::LOG_ERRORS, "Disabled intermediate commands.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OptionParser::has_flag('K', argc, argv)) {
|
if (OptionParser::has_flag('K', argc, argv)) {
|
||||||
rpc::call_command_set_value("method.use_intermediate.set", 2);
|
rpc::call_command_set_value("method.use_intermediate.set", 2);
|
||||||
lt_log_print(torrent::LOG_WARN, "Allowing intermediate commands without xmlrpc.");
|
lt_log_print(torrent::LOG_ERRORS, "Allowing intermediate commands without xmlrpc.");
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc::parse_command_multiple
|
rpc::parse_command_multiple
|
||||||
@@ -372,11 +373,11 @@ main(int argc, char** argv) {
|
|||||||
rpc::rpc.mark_safe("network.http.proxy_address");
|
rpc::rpc.mark_safe("network.http.proxy_address");
|
||||||
|
|
||||||
CMD2_ANY_VALUE_V("network.http.max_total_connections.set", [](auto, auto) {
|
CMD2_ANY_VALUE_V("network.http.max_total_connections.set", [](auto, auto) {
|
||||||
lt_log_print(torrent::LOG_WARN, "network.http.max_total_connections.set is deprecated, use system.sockets.http.min_alloc.set instead.");
|
lt_log_print(torrent::LOG_ERRORS, "network.http.max_total_connections.set is deprecated, use system.sockets.http.min_alloc.set instead.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CMD2_ANY_VALUE_V("network.max_open_files.set", [](auto, auto) {
|
CMD2_ANY_VALUE_V("network.max_open_files.set", [](auto, auto) {
|
||||||
lt_log_print(torrent::LOG_WARN, "network.max_open_files.set is deprecated, use system.sockets.files.min_alloc.set instead.");
|
lt_log_print(torrent::LOG_ERRORS, "network.max_open_files.set is deprecated, use system.sockets.files.min_alloc.set instead.");
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: Keep d.directory_base for a while as it is widely used.
|
// TODO: Keep d.directory_base for a while as it is widely used.
|
||||||
@@ -419,16 +420,16 @@ main(int argc, char** argv) {
|
|||||||
CMD_REDIRECT("max_memory_usage", "pieces.memory.max.set");
|
CMD_REDIRECT("max_memory_usage", "pieces.memory.max.set");
|
||||||
|
|
||||||
CMD_ANY_LIST("throttle.ip", []( auto, auto) {
|
CMD_ANY_LIST("throttle.ip", []( auto, auto) {
|
||||||
lt_log_print(torrent::LOG_WARN, "The 'throttle.ip' command is deprecated and does nothing.");
|
lt_log_print(torrent::LOG_ERRORS, "The 'throttle.ip' command is deprecated and does nothing.");
|
||||||
return torrent::Object();
|
return torrent::Object();
|
||||||
});
|
});
|
||||||
|
|
||||||
CMD_ANY("network.port_open", [](auto, auto) {
|
CMD_ANY("network.port_open", [](auto, auto) {
|
||||||
lt_log_print(torrent::LOG_WARN, "The 'network.port_open' command is deprecated and does nothing.");
|
lt_log_print(torrent::LOG_ERRORS, "The 'network.port_open' command is deprecated and does nothing.");
|
||||||
return torrent::Object();
|
return torrent::Object();
|
||||||
});
|
});
|
||||||
CMD_ANY("network.port_open.set", [](auto, auto) {
|
CMD_ANY("network.port_open.set", [](auto, auto) {
|
||||||
lt_log_print(torrent::LOG_WARN, "The 'network.port_open.set' command is deprecated and does nothing.");
|
lt_log_print(torrent::LOG_ERRORS, "The 'network.port_open.set' command is deprecated and does nothing.");
|
||||||
return torrent::Object();
|
return torrent::Object();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -443,7 +444,7 @@ main(int argc, char** argv) {
|
|||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
if (errno == EAFNOSUPPORT) {
|
if (errno == EAFNOSUPPORT) {
|
||||||
lt_log_print(torrent::LOG_WARN, "disabling ipv6 support, not available on system");
|
lt_log_print(torrent::LOG_ERRORS, "disabling ipv6 support, not available on system");
|
||||||
rpc::call_command_set_value("network.block.ipv6.set", true);
|
rpc::call_command_set_value("network.block.ipv6.set", true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -455,7 +456,7 @@ main(int argc, char** argv) {
|
|||||||
|
|
||||||
parse_config_file(argc, argv, [](auto& path) {
|
parse_config_file(argc, argv, [](auto& path) {
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
lt_log_print(torrent::LOG_WARN, "Ignoring rtorrent.rc.");
|
lt_log_print(torrent::LOG_ERRORS, "Ignoring rtorrent.rc.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,7 +500,7 @@ main(int argc, char** argv) {
|
|||||||
<< e.what() << std::endl
|
<< e.what() << std::endl
|
||||||
<< e.backtrace();
|
<< e.backtrace();
|
||||||
|
|
||||||
lt_log_print_dump(torrent::LOG_CRITICAL, e.backtrace().c_str(), e.backtrace().size(),
|
lt_log_print_dump(torrent::LOG_ERRORS, e.backtrace().c_str(), e.backtrace().size(),
|
||||||
"Caught internal_error: '%s'.", e.what());
|
"Caught internal_error: '%s'.", e.what());
|
||||||
|
|
||||||
torrent::log_cleanup();
|
torrent::log_cleanup();
|
||||||
@@ -511,7 +512,7 @@ main(int argc, char** argv) {
|
|||||||
|
|
||||||
std::cout << "rtorrent: caught" << typeid(e).name() << " : " << e.what() << std::endl;
|
std::cout << "rtorrent: caught" << typeid(e).name() << " : " << e.what() << std::endl;
|
||||||
|
|
||||||
lt_log_print(torrent::LOG_CRITICAL, "Caught exception: '%s'.", e.what());
|
lt_log_print(torrent::LOG_ERRORS, "Caught exception: '%s'.", e.what());
|
||||||
|
|
||||||
torrent::log_cleanup();
|
torrent::log_cleanup();
|
||||||
return -1;
|
return -1;
|
||||||
@@ -588,9 +589,9 @@ handle_sigbus(int signum, siginfo_t* sa, [[maybe_unused]] void* ptr) {
|
|||||||
handle_sigbus_exit:
|
handle_sigbus_exit:
|
||||||
std::cout << output.rdbuf();
|
std::cout << output.rdbuf();
|
||||||
|
|
||||||
if (lt_log_is_valid(torrent::LOG_CRITICAL)) {
|
if (lt_log_is_valid(torrent::LOG_ERRORS)) {
|
||||||
std::string dump = output.str();
|
std::string dump = output.str();
|
||||||
lt_log_print_dump(torrent::LOG_CRITICAL, dump.c_str(), dump.size(), "Caught signal: '%s'.", signal_reason);
|
lt_log_print_dump(torrent::LOG_ERRORS, dump.c_str(), dump.size(), "Caught signal: '%s'.", signal_reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent::log_cleanup();
|
torrent::log_cleanup();
|
||||||
@@ -629,9 +630,9 @@ do_panic(int signum) {
|
|||||||
|
|
||||||
std::cout << output.rdbuf();
|
std::cout << output.rdbuf();
|
||||||
|
|
||||||
if (lt_log_is_valid(torrent::LOG_CRITICAL)) {
|
if (lt_log_is_valid(torrent::LOG_ERRORS)) {
|
||||||
std::string dump = output.str();
|
std::string dump = output.str();
|
||||||
lt_log_print_dump(torrent::LOG_CRITICAL, dump.c_str(), dump.size(), "Caught signal: '%s.", strsignal(signum));
|
lt_log_print_dump(torrent::LOG_ERRORS, dump.c_str(), dump.size(), "Caught signal: '%s.", strsignal(signum));
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent::log_cleanup();
|
torrent::log_cleanup();
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ ThreadScgi::change_rpc_log() {
|
|||||||
::close(scgi()->log_fd());
|
::close(scgi()->log_fd());
|
||||||
scgi()->set_log_fd(-1);
|
scgi()->set_log_fd(-1);
|
||||||
|
|
||||||
lt_log_print(torrent::LOG_NOTICE, "Closed RPC log.", 0);
|
lt_log_print(torrent::LOG_EVENTS, "Closed RPC log.", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_rpc_log_filename.empty())
|
if (m_rpc_log_filename.empty())
|
||||||
@@ -91,11 +91,11 @@ ThreadScgi::change_rpc_log() {
|
|||||||
scgi()->set_log_fd(open(expand_path(m_rpc_log_filename).c_str(), O_WRONLY | O_APPEND | O_CREAT, 0644));
|
scgi()->set_log_fd(open(expand_path(m_rpc_log_filename).c_str(), O_WRONLY | O_APPEND | O_CREAT, 0644));
|
||||||
|
|
||||||
if (scgi()->log_fd() == -1) {
|
if (scgi()->log_fd() == -1) {
|
||||||
lt_log_print(torrent::LOG_NOTICE, "Could not open RPC log file '%s'.", m_rpc_log_filename.c_str());
|
lt_log_print(torrent::LOG_EVENTS, "Could not open RPC log file '%s'.", m_rpc_log_filename.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lt_log_print(torrent::LOG_NOTICE, "Logging RPC events to '%s'.", m_rpc_log_filename.c_str());
|
lt_log_print(torrent::LOG_EVENTS, "Logging RPC events to '%s'.", m_rpc_log_filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ SessionManager::process_finished_saves() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
lt_log_print(torrent::LOG_ERROR, "Storage errors saving session data for download: ignored:%u : %s", m_ignored_storage_error_count, e.what());
|
lt_log_print(torrent::LOG_ERRORS, "Storage errors saving session data for download: ignored:%u : %s", m_ignored_storage_error_count, e.what());
|
||||||
|
|
||||||
m_last_storage_error_message = torrent::this_thread::cached_time();
|
m_last_storage_error_message = torrent::this_thread::cached_time();
|
||||||
m_ignored_storage_error_count = 0;
|
m_ignored_storage_error_count = 0;
|
||||||
|
|||||||
+1
-1
@@ -142,7 +142,7 @@ parse_config_file_comments(const std::string& path) {
|
|||||||
else
|
else
|
||||||
throw torrent::input_error("Unknown command in config file comment: " + line);
|
throw torrent::input_error("Unknown command in config file comment: " + line);
|
||||||
|
|
||||||
lt_log_print(torrent::LOG_NOTICE, "Pre-config command: %s=%s", command.c_str(), args.c_str());
|
lt_log_print(torrent::LOG_EVENTS, "Pre-config command: %s=%s", command.c_str(), args.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ DownloadList::receive_exit_input(Input type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (torrent::input_error& e) {
|
} catch (torrent::input_error& e) {
|
||||||
lt_log_print(torrent::LOG_WARN, "Input failed: %s", e.what());
|
lt_log_print(torrent::LOG_ERRORS, "Input failed: %s", e.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
activate_display(DISPLAY_DOWNLOAD_LIST);
|
activate_display(DISPLAY_DOWNLOAD_LIST);
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ ElementDownloadList::receive_command(const char* cmd) {
|
|||||||
m_view->set_last_changed();
|
m_view->set_last_changed();
|
||||||
|
|
||||||
} catch (torrent::input_error& e) {
|
} catch (torrent::input_error& e) {
|
||||||
lt_log_print(torrent::LOG_WARN, "Command failed: %s", e.what());
|
lt_log_print(torrent::LOG_ERRORS, "Command failed: %s", e.what());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -380,7 +380,7 @@ Root::set_input_history_size(int size) {
|
|||||||
void
|
void
|
||||||
Root::load_input_history() {
|
Root::load_input_history() {
|
||||||
if (m_control == nullptr || !session_thread::manager()->is_used()) {
|
if (m_control == nullptr || !session_thread::manager()->is_used()) {
|
||||||
lt_log_print(torrent::LOG_DEBUG, "ignoring input history file");
|
lt_log_print(torrent::LOG_DEBUG_TRACE, "ignoring input history file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,10 +415,10 @@ Root::load_input_history() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (history_file.bad()) {
|
if (history_file.bad()) {
|
||||||
lt_log_print(torrent::LOG_DEBUG, "input history file corrupted, discarding (path:%s)", history_filename.c_str());
|
lt_log_print(torrent::LOG_DEBUG_TRACE, "input history file corrupted, discarding (path:%s)", history_filename.c_str());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
lt_log_print(torrent::LOG_DEBUG, "input history file read (path:%s)", history_filename.c_str());
|
lt_log_print(torrent::LOG_DEBUG_TRACE, "input history file read (path:%s)", history_filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& [entry, category] : input_history_tmp) {
|
for (const auto& [entry, category] : input_history_tmp) {
|
||||||
@@ -441,7 +441,7 @@ Root::load_input_history() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lt_log_print(torrent::LOG_DEBUG, "could not open input history file (path:%s)", history_filename.c_str());
|
lt_log_print(torrent::LOG_DEBUG_TRACE, "could not open input history file (path:%s)", history_filename.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ Root::save_input_history() {
|
|||||||
auto history_file = std::fstream(history_filename_tmp.c_str(), std::ios::out | std::ios::trunc);
|
auto history_file = std::fstream(history_filename_tmp.c_str(), std::ios::out | std::ios::trunc);
|
||||||
|
|
||||||
if (!history_file.is_open()) {
|
if (!history_file.is_open()) {
|
||||||
lt_log_print(torrent::LOG_DEBUG, "could not open input history file for writing (path:%s)", history_filename.c_str());
|
lt_log_print(torrent::LOG_DEBUG_TRACE, "could not open input history file for writing (path:%s)", history_filename.c_str());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -471,10 +471,10 @@ Root::save_input_history() {
|
|||||||
history_file.close();
|
history_file.close();
|
||||||
|
|
||||||
if (!history_file.good()) {
|
if (!history_file.good()) {
|
||||||
lt_log_print(torrent::LOG_DEBUG, "input history file corrupted during writing, discarding (path:%s)", history_filename.c_str());
|
lt_log_print(torrent::LOG_DEBUG_TRACE, "input history file corrupted during writing, discarding (path:%s)", history_filename.c_str());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
lt_log_print(torrent::LOG_DEBUG, "input history file written (path:%s)", history_filename.c_str());
|
lt_log_print(torrent::LOG_DEBUG_TRACE, "input history file written (path:%s)", history_filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::rename(history_filename_tmp.c_str(), history_filename.c_str());
|
std::rename(history_filename_tmp.c_str(), history_filename.c_str());
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ assert_arg_count_error(const std::string& line) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
TestSetup::test_config_comment_log_add_output() {
|
TestSetup::test_config_comment_log_add_output() {
|
||||||
temp_config_file file("# do:log.add_output=debug,test_output");
|
temp_config_file file("# do:log.add_output=debug_trace,test_output");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_NO_THROW(parse_config_file_comments(file.path()));
|
CPPUNIT_ASSERT_NO_THROW(parse_config_file_comments(file.path()));
|
||||||
}
|
}
|
||||||
@@ -69,10 +69,10 @@ TestSetup::test_config_comment_log_add_output_no_args() {
|
|||||||
|
|
||||||
void
|
void
|
||||||
TestSetup::test_config_comment_log_add_output_one_arg() {
|
TestSetup::test_config_comment_log_add_output_one_arg() {
|
||||||
assert_arg_count_error("# do:log.add_output=debug");
|
assert_arg_count_error("# do:log.add_output=debug_trace");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TestSetup::test_config_comment_log_add_output_too_many_args() {
|
TestSetup::test_config_comment_log_add_output_too_many_args() {
|
||||||
assert_arg_count_error("# do:log.add_output=debug,test_output,extra");
|
assert_arg_count_error("# do:log.add_output=debug_trace,test_output,extra");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user