Commit 2bc6ffff authored by rakshasa's avatar rakshasa

Added dht_all logging.

parent 382fe39e
......@@ -173,9 +173,13 @@ log_group::internal_print(const HashString* hash, const char* subsystem, const v
char buffer[buffer_size];
char* first = buffer;
if (hash != NULL && subsystem != NULL) {
first = hash_string_to_hex(*hash, first);
first += snprintf(first, 4096 - (first - buffer), "->%s: ", subsystem);
if (subsystem != NULL) {
if (hash != NULL) {
first = hash_string_to_hex(*hash, first);
first += snprintf(first, 4096 - (first - buffer), "->%s: ", subsystem);
} else {
first += snprintf(first, 4096 - (first - buffer), "%s: ", subsystem);
}
}
va_start(ap, fmt);
......@@ -401,9 +405,9 @@ log_open_file_output(const char* name, const char* filename) {
throw input_error("Could not open log file '" + std::string(filename) + "'.");
log_open_output(name, std::bind(&log_file_write, outfile,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
}
void
......@@ -417,9 +421,9 @@ log_open_gz_file_output(const char* name, const char* filename) {
// throw input_error("Could not set gzip log file buffer size.");
log_open_output(name, std::bind(&log_gz_file_write, outfile,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
}
log_buffer*
......@@ -428,9 +432,9 @@ log_open_log_buffer(const char* name) {
try {
log_open_output(name, std::bind(&log_buffer::lock_and_push_log, buffer,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
return buffer;
} catch (torrent::input_error& e) {
......
......@@ -113,10 +113,11 @@ enum {
LOG_NON_CASCADING,
LOG_DHT_ALL,
LOG_INSTRUMENTATION_MEMORY,
LOG_INSTRUMENTATION_MINCORE,
LOG_INSTRUMENTATION_CHOKE,
LOG_INSTRUMENTATION_POLLING,
LOG_INSTRUMENTATION_TRANSFERS,
......@@ -159,6 +160,10 @@ enum {
if (torrent::log_groups[log_group].valid()) \
torrent::log_groups[log_group].internal_print(&log_info->hash(), log_subsystem, log_dump_data, log_dump_size, __VA_ARGS__); \
#define lt_log_print_subsystem(log_group, log_subsystem, ...) \
if (torrent::log_groups[log_group].valid()) \
torrent::log_groups[log_group].internal_print(NULL, log_subsystem, NULL, 0, __VA_ARGS__);
class log_buffer;
typedef std::function<void (const char*, unsigned int, int)> log_slot;
......
......@@ -190,6 +190,8 @@ const char* option_list_log_group[] = {
"__non_cascading__",
"dht_all",
"instrumentation_memory",
"instrumentation_mincore",
"instrumentation_choke",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment