diff options
author | Maxim Biro <nurupo.contributions@gmail.com> | 2015-12-30 21:49:00 -0500 |
---|---|---|
committer | Maxim Biro <nurupo.contributions@gmail.com> | 2015-12-30 21:49:00 -0500 |
commit | 78d6e2d58b4e4e18e6a3045e0d8b3b29392d8238 (patch) | |
tree | a07b968187a56bd99a3469d7b200155e9722d04a /other/bootstrap_daemon | |
parent | 0938ba08d9a839df4111168f3414099268d69737 (diff) |
Change log levels
Some of them were set incorrectly, e.g. something that caused the
daemon to exit was marked as just a warning, instead of an error.
Removed debug level as it was hard to decide whether something should
go into info or debug. This is mostly because the use of the debug level
wasn't well defined. Debug should be used for information that could
help a user to debug an issue, but messages marked as debug were by the
most part the "success" log messages, which could go into info level
instead.
Diffstat (limited to 'other/bootstrap_daemon')
-rw-r--r-- | other/bootstrap_daemon/tox-bootstrapd.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c index 267e7238..71b1386d 100644 --- a/other/bootstrap_daemon/tox-bootstrapd.c +++ b/other/bootstrap_daemon/tox-bootstrapd.c | |||
@@ -144,7 +144,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int | |||
144 | int i; | 144 | int i; |
145 | 145 | ||
146 | for (i = 0; i < DEFAULT_TCP_RELAY_PORTS_COUNT; i ++) { | 146 | for (i = 0; i < DEFAULT_TCP_RELAY_PORTS_COUNT; i ++) { |
147 | syslog(LOG_WARNING, "Port #%d: %u\n", i, default_ports[i]); | 147 | syslog(LOG_INFO, "Port #%d: %u\n", i, default_ports[i]); |
148 | } | 148 | } |
149 | 149 | ||
150 | // similar procedure to the one of reading config file below | 150 | // similar procedure to the one of reading config file below |
@@ -176,7 +176,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int | |||
176 | } | 176 | } |
177 | 177 | ||
178 | if (config_setting_is_array(ports_array) == CONFIG_FALSE) { | 178 | if (config_setting_is_array(ports_array) == CONFIG_FALSE) { |
179 | syslog(LOG_WARNING, "'%s' setting should be an array. Array syntax: 'setting = [value1, value2, ...]'.\n", | 179 | syslog(LOG_ERR, "'%s' setting should be an array. Array syntax: 'setting = [value1, value2, ...]'.\n", |
180 | NAME_TCP_RELAY_PORTS); | 180 | NAME_TCP_RELAY_PORTS); |
181 | return; | 181 | return; |
182 | } | 182 | } |
@@ -184,7 +184,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int | |||
184 | int config_port_count = config_setting_length(ports_array); | 184 | int config_port_count = config_setting_length(ports_array); |
185 | 185 | ||
186 | if (config_port_count == 0) { | 186 | if (config_port_count == 0) { |
187 | syslog(LOG_WARNING, "'%s' is empty.\n", NAME_TCP_RELAY_PORTS); | 187 | syslog(LOG_ERR, "'%s' is empty.\n", NAME_TCP_RELAY_PORTS); |
188 | return; | 188 | return; |
189 | } | 189 | } |
190 | 190 | ||
@@ -357,34 +357,34 @@ int get_general_config(const char *cfg_file_path, char **pid_file_path, char **k | |||
357 | 357 | ||
358 | config_destroy(&cfg); | 358 | config_destroy(&cfg); |
359 | 359 | ||
360 | syslog(LOG_DEBUG, "Successfully read:\n"); | 360 | syslog(LOG_INFO, "Successfully read:\n"); |
361 | syslog(LOG_DEBUG, "'%s': %s\n", NAME_PID_FILE_PATH, *pid_file_path); | 361 | syslog(LOG_INFO, "'%s': %s\n", NAME_PID_FILE_PATH, *pid_file_path); |
362 | syslog(LOG_DEBUG, "'%s': %s\n", NAME_KEYS_FILE_PATH, *keys_file_path); | 362 | syslog(LOG_INFO, "'%s': %s\n", NAME_KEYS_FILE_PATH, *keys_file_path); |
363 | syslog(LOG_DEBUG, "'%s': %d\n", NAME_PORT, *port); | 363 | syslog(LOG_INFO, "'%s': %d\n", NAME_PORT, *port); |
364 | syslog(LOG_DEBUG, "'%s': %s\n", NAME_ENABLE_IPV6, *enable_ipv6 ? "true" : "false"); | 364 | syslog(LOG_INFO, "'%s': %s\n", NAME_ENABLE_IPV6, *enable_ipv6 ? "true" : "false"); |
365 | syslog(LOG_DEBUG, "'%s': %s\n", NAME_ENABLE_IPV4_FALLBACK, *enable_ipv4_fallback ? "true" : "false"); | 365 | syslog(LOG_INFO, "'%s': %s\n", NAME_ENABLE_IPV4_FALLBACK, *enable_ipv4_fallback ? "true" : "false"); |
366 | syslog(LOG_DEBUG, "'%s': %s\n", NAME_ENABLE_LAN_DISCOVERY, *enable_lan_discovery ? "true" : "false"); | 366 | syslog(LOG_INFO, "'%s': %s\n", NAME_ENABLE_LAN_DISCOVERY, *enable_lan_discovery ? "true" : "false"); |
367 | 367 | ||
368 | syslog(LOG_DEBUG, "'%s': %s\n", NAME_ENABLE_TCP_RELAY, *enable_tcp_relay ? "true" : "false"); | 368 | syslog(LOG_INFO, "'%s': %s\n", NAME_ENABLE_TCP_RELAY, *enable_tcp_relay ? "true" : "false"); |
369 | 369 | ||
370 | // show info about tcp ports only if tcp relay is enabled | 370 | // show info about tcp ports only if tcp relay is enabled |
371 | if (*enable_tcp_relay) { | 371 | if (*enable_tcp_relay) { |
372 | if (*tcp_relay_port_count == 0) { | 372 | if (*tcp_relay_port_count == 0) { |
373 | syslog(LOG_DEBUG, "No TCP ports could be read.\n"); | 373 | syslog(LOG_ERR, "No TCP ports could be read.\n"); |
374 | } else { | 374 | } else { |
375 | syslog(LOG_DEBUG, "Read %d TCP ports:\n", *tcp_relay_port_count); | 375 | syslog(LOG_INFO, "Read %d TCP ports:\n", *tcp_relay_port_count); |
376 | int i; | 376 | int i; |
377 | 377 | ||
378 | for (i = 0; i < *tcp_relay_port_count; i ++) { | 378 | for (i = 0; i < *tcp_relay_port_count; i ++) { |
379 | syslog(LOG_DEBUG, "Port #%d: %u\n", i, (*tcp_relay_ports)[i]); | 379 | syslog(LOG_INFO, "Port #%d: %u\n", i, (*tcp_relay_ports)[i]); |
380 | } | 380 | } |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | syslog(LOG_DEBUG, "'%s': %s\n", NAME_ENABLE_MOTD, *enable_motd ? "true" : "false"); | 384 | syslog(LOG_INFO, "'%s': %s\n", NAME_ENABLE_MOTD, *enable_motd ? "true" : "false"); |
385 | 385 | ||
386 | if (*enable_motd) { | 386 | if (*enable_motd) { |
387 | syslog(LOG_DEBUG, "'%s': %s\n", NAME_MOTD, *motd); | 387 | syslog(LOG_INFO, "'%s': %s\n", NAME_MOTD, *motd); |
388 | } | 388 | } |
389 | 389 | ||
390 | return 1; | 390 | return 1; |
@@ -483,7 +483,7 @@ int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6) | |||
483 | goto next; | 483 | goto next; |
484 | } | 484 | } |
485 | 485 | ||
486 | syslog(LOG_DEBUG, "Successfully added bootstrap node #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key); | 486 | syslog(LOG_INFO, "Successfully added bootstrap node #%d: %s:%d %s\n", i, bs_address, bs_port, bs_public_key); |
487 | 487 | ||
488 | next: | 488 | next: |
489 | // config_setting_lookup_string() allocates string inside and doesn't allow us to free it direcly | 489 | // config_setting_lookup_string() allocates string inside and doesn't allow us to free it direcly |
@@ -541,7 +541,7 @@ int main(int argc, char *argv[]) | |||
541 | 541 | ||
542 | if (get_general_config(cfg_file_path, &pid_file_path, &keys_file_path, &port, &enable_ipv6, &enable_ipv4_fallback, | 542 | if (get_general_config(cfg_file_path, &pid_file_path, &keys_file_path, &port, &enable_ipv6, &enable_ipv4_fallback, |
543 | &enable_lan_discovery, &enable_tcp_relay, &tcp_relay_ports, &tcp_relay_port_count, &enable_motd, &motd)) { | 543 | &enable_lan_discovery, &enable_tcp_relay, &tcp_relay_ports, &tcp_relay_port_count, &enable_motd, &motd)) { |
544 | syslog(LOG_DEBUG, "General config read successfully\n"); | 544 | syslog(LOG_INFO, "General config read successfully\n"); |
545 | } else { | 545 | } else { |
546 | syslog(LOG_ERR, "Couldn't read config file: %s. Exiting.\n", cfg_file_path); | 546 | syslog(LOG_ERR, "Couldn't read config file: %s. Exiting.\n", cfg_file_path); |
547 | return 1; | 547 | return 1; |
@@ -556,7 +556,7 @@ int main(int argc, char *argv[]) | |||
556 | FILE *pid_file; | 556 | FILE *pid_file; |
557 | 557 | ||
558 | if ((pid_file = fopen(pid_file_path, "r"))) { | 558 | if ((pid_file = fopen(pid_file_path, "r"))) { |
559 | syslog(LOG_ERR, "Another instance of the daemon is already running, PID file %s exists.\n", pid_file_path); | 559 | syslog(LOG_WARNING, "Another instance of the daemon is already running, PID file %s exists.\n", pid_file_path); |
560 | fclose(pid_file); | 560 | fclose(pid_file); |
561 | } | 561 | } |
562 | 562 | ||
@@ -567,17 +567,17 @@ int main(int argc, char *argv[]) | |||
567 | 567 | ||
568 | if (net == NULL) { | 568 | if (net == NULL) { |
569 | if (enable_ipv6 && enable_ipv4_fallback) { | 569 | if (enable_ipv6 && enable_ipv4_fallback) { |
570 | syslog(LOG_DEBUG, "Couldn't initialize IPv6 networking. Falling back to using IPv4.\n"); | 570 | syslog(LOG_WARNING, "Couldn't initialize IPv6 networking. Falling back to using IPv4.\n"); |
571 | enable_ipv6 = 0; | 571 | enable_ipv6 = 0; |
572 | ip_init(&ip, enable_ipv6); | 572 | ip_init(&ip, enable_ipv6); |
573 | net = new_networking(ip, port); | 573 | net = new_networking(ip, port); |
574 | 574 | ||
575 | if (net == NULL) { | 575 | if (net == NULL) { |
576 | syslog(LOG_DEBUG, "Couldn't fallback to IPv4. Exiting.\n"); | 576 | syslog(LOG_ERR, "Couldn't fallback to IPv4. Exiting.\n"); |
577 | return 1; | 577 | return 1; |
578 | } | 578 | } |
579 | } else { | 579 | } else { |
580 | syslog(LOG_DEBUG, "Couldn't initialize networking. Exiting.\n"); | 580 | syslog(LOG_ERR, "Couldn't initialize networking. Exiting.\n"); |
581 | return 1; | 581 | return 1; |
582 | } | 582 | } |
583 | } | 583 | } |
@@ -600,7 +600,7 @@ int main(int argc, char *argv[]) | |||
600 | 600 | ||
601 | if (enable_motd) { | 601 | if (enable_motd) { |
602 | if (bootstrap_set_callbacks(dht->net, DAEMON_VERSION_NUMBER, (uint8_t *)motd, strlen(motd) + 1) == 0) { | 602 | if (bootstrap_set_callbacks(dht->net, DAEMON_VERSION_NUMBER, (uint8_t *)motd, strlen(motd) + 1) == 0) { |
603 | syslog(LOG_DEBUG, "Set MOTD successfully.\n"); | 603 | syslog(LOG_INFO, "Set MOTD successfully.\n"); |
604 | } else { | 604 | } else { |
605 | syslog(LOG_ERR, "Couldn't set MOTD: %s. Exiting.\n", motd); | 605 | syslog(LOG_ERR, "Couldn't set MOTD: %s. Exiting.\n", motd); |
606 | return 1; | 606 | return 1; |
@@ -610,7 +610,7 @@ int main(int argc, char *argv[]) | |||
610 | } | 610 | } |
611 | 611 | ||
612 | if (manage_keys(dht, keys_file_path)) { | 612 | if (manage_keys(dht, keys_file_path)) { |
613 | syslog(LOG_DEBUG, "Keys are managed successfully.\n"); | 613 | syslog(LOG_INFO, "Keys are managed successfully.\n"); |
614 | } else { | 614 | } else { |
615 | syslog(LOG_ERR, "Couldn't read/write: %s. Exiting.\n", keys_file_path); | 615 | syslog(LOG_ERR, "Couldn't read/write: %s. Exiting.\n", keys_file_path); |
616 | return 1; | 616 | return 1; |
@@ -630,7 +630,7 @@ int main(int argc, char *argv[]) | |||
630 | free(tcp_relay_ports); | 630 | free(tcp_relay_ports); |
631 | 631 | ||
632 | if (tcp_server != NULL) { | 632 | if (tcp_server != NULL) { |
633 | syslog(LOG_DEBUG, "Initialized Tox TCP server successfully.\n"); | 633 | syslog(LOG_INFO, "Initialized Tox TCP server successfully.\n"); |
634 | } else { | 634 | } else { |
635 | syslog(LOG_ERR, "Couldn't initialize Tox TCP server. Exiting.\n"); | 635 | syslog(LOG_ERR, "Couldn't initialize Tox TCP server. Exiting.\n"); |
636 | return 1; | 636 | return 1; |
@@ -638,7 +638,7 @@ int main(int argc, char *argv[]) | |||
638 | } | 638 | } |
639 | 639 | ||
640 | if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) { | 640 | if (bootstrap_from_config(cfg_file_path, dht, enable_ipv6)) { |
641 | syslog(LOG_DEBUG, "List of bootstrap nodes read successfully.\n"); | 641 | syslog(LOG_INFO, "List of bootstrap nodes read successfully.\n"); |
642 | } else { | 642 | } else { |
643 | syslog(LOG_ERR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path); | 643 | syslog(LOG_ERR, "Couldn't read list of bootstrap nodes in %s. Exiting.\n", cfg_file_path); |
644 | return 1; | 644 | return 1; |
@@ -663,7 +663,7 @@ int main(int argc, char *argv[]) | |||
663 | if (pid > 0) { | 663 | if (pid > 0) { |
664 | fprintf(pidf, "%d", pid); | 664 | fprintf(pidf, "%d", pid); |
665 | fclose(pidf); | 665 | fclose(pidf); |
666 | syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid); | 666 | syslog(LOG_INFO, "Forked successfully: PID: %d.\n", pid); |
667 | return 0; | 667 | return 0; |
668 | } else { | 668 | } else { |
669 | fclose(pidf); | 669 | fclose(pidf); |
@@ -701,7 +701,7 @@ int main(int argc, char *argv[]) | |||
701 | 701 | ||
702 | if (enable_lan_discovery) { | 702 | if (enable_lan_discovery) { |
703 | LANdiscovery_init(dht); | 703 | LANdiscovery_init(dht); |
704 | syslog(LOG_DEBUG, "Initialized LAN discovery.\n"); | 704 | syslog(LOG_INFO, "Initialized LAN discovery.\n"); |
705 | } | 705 | } |
706 | 706 | ||
707 | while (1) { | 707 | while (1) { |
@@ -719,7 +719,7 @@ int main(int argc, char *argv[]) | |||
719 | networking_poll(dht->net); | 719 | networking_poll(dht->net); |
720 | 720 | ||
721 | if (waiting_for_dht_connection && DHT_isconnected(dht)) { | 721 | if (waiting_for_dht_connection && DHT_isconnected(dht)) { |
722 | syslog(LOG_DEBUG, "Connected to other bootstrap node successfully.\n"); | 722 | syslog(LOG_INFO, "Connected to other bootstrap node successfully.\n"); |
723 | waiting_for_dht_connection = 0; | 723 | waiting_for_dht_connection = 0; |
724 | } | 724 | } |
725 | 725 | ||