Changeset 13868
- Timestamp:
- Jan 25, 2013, 11:34:20 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 54 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/daemon/daemon.c
r13683 r13868 26 26 #include <libtransmission/transmission.h> 27 27 #include <libtransmission/tr-getopt.h> 28 #include <libtransmission/log.h> 28 29 #include <libtransmission/utils.h> 29 30 #include <libtransmission/variant.h> … … 146 147 if (!mySession) 147 148 { 148 tr_ inf("Deferring reload until session is fully started.");149 tr_logAddInfo ("Deferring reload until session is fully started."); 149 150 seenHUP = true; 150 151 } … … 162 163 163 164 configDir = tr_sessionGetConfigDir (mySession); 164 tr_ inf("Reloading settings from \"%s\"", configDir);165 tr_logAddInfo ("Reloading settings from \"%s\"", configDir); 165 166 tr_variantInitDict (&settings, 0); 166 167 tr_variantDictAddBool (&settings, TR_KEY_rpc_enabled, true); … … 174 175 175 176 default: 176 tr_ err ("Unexpected signal (%d) in daemon, closing.", sig);177 tr_logAddError ("Unexpected signal (%d) in daemon, closing.", sig); 177 178 /* no break */ 178 179 … … 266 267 267 268 if (err == TR_PARSE_ERR) 268 tr_ err ("Error parsing .torrent file \"%s\"", file);269 tr_logAddError ("Error parsing .torrent file \"%s\"", file); 269 270 else 270 271 { … … 272 273 int test = tr_ctorGetDeleteSource (ctor, &trash); 273 274 274 tr_ inf("Parsing .torrent file successful \"%s\"", file);275 tr_logAddInfo ("Parsing .torrent file successful \"%s\"", file); 275 276 276 277 if (!test && trash) 277 278 { 278 tr_ inf("Deleting input .torrent file \"%s\"", file);279 tr_logAddInfo ("Deleting input .torrent file \"%s\"", file); 279 280 if (remove (filename)) 280 tr_ err ("Error deleting .torrent file: %s", tr_strerror (errno));281 tr_logAddError ("Error deleting .torrent file: %s", tr_strerror (errno)); 281 282 } 282 283 else … … 299 300 { 300 301 char timestr[64]; 301 tr_ getLogTimeStr (timestr, sizeof (timestr));302 tr_logGetTimeStr (timestr, sizeof (timestr)); 302 303 if (name) 303 304 fprintf (logfile, "[%s] %s %s (%s:%d)\n", timestr, name, message, file, line); … … 312 313 /* figure out the syslog priority */ 313 314 switch (level) { 314 case TR_ MSG_ERR: priority = LOG_ERR; break;315 case TR_ MSG_DBG: priority = LOG_DEBUG; break;316 default: priority = LOG_INFO; break;315 case TR_LOG_ERROR: priority = LOG_ERR; break; 316 case TR_LOG_DEBUG: priority = LOG_DEBUG; break; 317 default: priority = LOG_INFO; break; 317 318 } 318 319 … … 328 329 pumpLogMessages (FILE * logfile) 329 330 { 330 const tr_ msg_list* l;331 tr_ msg_list * list = tr_getQueuedMessages();331 const tr_log_message * l; 332 tr_log_message * list = tr_logGetQueue (); 332 333 333 334 for (l=list; l!=NULL; l=l->next) … … 337 338 fflush (logfile); 338 339 339 tr_ freeMessageList(list);340 tr_logFreeQueue (list); 340 341 } 341 342 … … 468 469 case 'Y': tr_variantDictAddBool (&settings, TR_KEY_lpd_enabled, false); 469 470 break; 470 case 810: tr_variantDictAddInt (&settings, TR_KEY_message_level, TR_ MSG_ERR);471 break; 472 case 811: tr_variantDictAddInt (&settings, TR_KEY_message_level, TR_ MSG_INF);473 break; 474 case 812: tr_variantDictAddInt (&settings, TR_KEY_message_level, TR_ MSG_DBG);471 case 810: tr_variantDictAddInt (&settings, TR_KEY_message_level, TR_LOG_ERROR); 472 break; 473 case 811: tr_variantDictAddInt (&settings, TR_KEY_message_level, TR_LOG_INFO); 474 break; 475 case 812: tr_variantDictAddInt (&settings, TR_KEY_message_level, TR_LOG_DEBUG); 475 476 break; 476 477 case 830: tr_variantDictAddBool (&settings, TR_KEY_utp_enabled, true); … … 488 489 if (!loaded) 489 490 { 490 printMessage (logfile, TR_ MSG_ERR, MY_NAME, "Error loading config file -- exiting.", __FILE__, __LINE__);491 printMessage (logfile, TR_LOG_ERROR, MY_NAME, "Error loading config file -- exiting.", __FILE__, __LINE__); 491 492 return -1; 492 493 } … … 504 505 char buf[256]; 505 506 tr_snprintf (buf, sizeof (buf), "Failed to daemonize: %s", tr_strerror (errno)); 506 printMessage (logfile, TR_ MSG_ERR, MY_NAME, buf, __FILE__, __LINE__);507 printMessage (logfile, TR_LOG_ERROR, MY_NAME, buf, __FILE__, __LINE__); 507 508 exit (1); 508 509 } … … 514 515 session = tr_sessionInit ("daemon", configDir, true, &settings); 515 516 tr_sessionSetRPCCallback (session, on_rpc_callback, NULL); 516 tr_ ninf(NULL, "Using settings from \"%s\"", configDir);517 tr_logAddNamedInfo (NULL, "Using settings from \"%s\"", configDir); 517 518 tr_sessionSaveSettings (session, configDir, &settings); 518 519 … … 526 527 fprintf (fp, "%d", (int)getpid ()); 527 528 fclose (fp); 528 tr_ inf("Saved pidfile \"%s\"", pid_filename);529 tr_logAddInfo ("Saved pidfile \"%s\"", pid_filename); 529 530 pidfile_created = true; 530 531 } 531 532 else 532 tr_ err ("Unable to save pidfile \"%s\": %s", pid_filename, tr_strerror (errno));533 tr_logAddError ("Unable to save pidfile \"%s\": %s", pid_filename, tr_strerror (errno)); 533 534 } 534 535 535 536 if (tr_variantDictFindBool (&settings, TR_KEY_rpc_authentication_required, &boolVal) && boolVal) 536 tr_ ninf(MY_NAME, "requiring authentication");537 tr_logAddNamedInfo (MY_NAME, "requiring authentication"); 537 538 538 539 mySession = session; … … 552 553 && *dir) 553 554 { 554 tr_ inf("Watching \"%s\" for new .torrent files", dir);555 tr_logAddInfo ("Watching \"%s\" for new .torrent files", dir); 555 556 watchdir = dtr_watchdir_new (mySession, dir, onFileAdded); 556 557 } -
trunk/daemon/remote.c
r13839 r13868 31 31 32 32 #include <libtransmission/transmission.h> 33 #include <libtransmission/log.h> 33 34 #include <libtransmission/rpcimpl.h> 34 35 #include <libtransmission/tr-getopt.h> … … 1678 1679 if (tr_variantFromJson (&top, response, len)) 1679 1680 { 1680 tr_ nerr (MY_NAME, "Unable to parse response \"%*.*s\"", (int)len,1681 tr_logAddNamedError (MY_NAME, "Unable to parse response \"%*.*s\"", (int)len, 1681 1682 (int)len, (char*)response); 1682 1683 status |= EXIT_FAILURE; … … 1804 1805 if ((res = curl_easy_perform (curl))) 1805 1806 { 1806 tr_ nerr (MY_NAME, " (%s) %s", rpcurl_http, curl_easy_strerror (res));1807 tr_logAddNamedError (MY_NAME, " (%s) %s", rpcurl_http, curl_easy_strerror (res)); 1807 1808 status |= EXIT_FAILURE; 1808 1809 } -
trunk/daemon/watch.c
r13726 r13868 27 27 28 28 #include <libtransmission/transmission.h> 29 #include <libtransmission/utils.h> /* tr_buildPath (), tr_inf () */ 29 #include <libtransmission/log.h> 30 #include <libtransmission/utils.h> /* tr_buildPath (), tr_logAddInfo () */ 30 31 #include "watch.h" 31 32 … … 71 72 else 72 73 { 73 tr_ inf("Using inotify to watch directory \"%s\"", w->dir);74 tr_logAddInfo ("Using inotify to watch directory \"%s\"", w->dir); 74 75 i = inotify_add_watch (w->inotify_fd, w->dir, DTR_INOTIFY_MASK); 75 76 } … … 77 78 if (i < 0) 78 79 { 79 tr_ err ("Unable to watch \"%s\": %s", w->dir, tr_strerror (errno));80 tr_logAddError ("Unable to watch \"%s\": %s", w->dir, tr_strerror (errno)); 80 81 } 81 82 else if ((odir = opendir (w->dir))) … … 90 91 continue; 91 92 92 tr_ inf("Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir);93 tr_logAddInfo ("Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir); 93 94 w->callback (w->session, w->dir, name); 94 95 } … … 139 140 if (tr_str_has_suffix (name, ".torrent")) 140 141 { 141 tr_ inf("Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir);142 tr_logAddInfo ("Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir); 142 143 w->callback (w->session, w->dir, name); 143 144 } … … 160 161 watchdir_new_impl (dtr_watchdir * w UNUSED) 161 162 { 162 tr_ inf("Using readdir to watch directory \"%s\"", w->dir);163 tr_logAddInfo ("Using readdir to watch directory \"%s\"", w->dir); 163 164 w->lastFiles = evbuffer_new (); 164 165 } … … 226 227 /* if this file wasn't here last time, try adding it */ 227 228 if (!is_file_in_list (w->lastFiles, name, len)) { 228 tr_ inf("Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir);229 tr_logAddInfo ("Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir); 229 230 w->callback (w->session, w->dir, name); 230 231 } -
trunk/gtk/main.c
r13795 r13868 607 607 608 608 /* init glib/gtk */ 609 #if !GLIB_CHECK_VERSION(2,35,4) 609 610 g_type_init (); 611 #endif 610 612 gtk_init (&argc, &argv); 611 613 g_set_application_name (_("Transmission")); … … 1089 1091 1090 1092 case TR_KEY_message_level: 1091 tr_ setMessageLevel (gtr_pref_int_get (key));1093 tr_logSetLevel (gtr_pref_int_get (key)); 1092 1094 break; 1093 1095 -
trunk/gtk/msgwin.c
r13761 r13868 19 19 20 20 #include <libtransmission/transmission.h> 21 #include <libtransmission/log.h> 21 22 22 23 #include "conf.h" … … 43 44 GtkTreeModel * filter; 44 45 GtkTreeModel * sort; 45 tr_ msg_level maxLevel;46 tr_log_level maxLevel; 46 47 gboolean isPaused; 47 48 guint refresh_tag; 48 49 }; 49 50 50 static struct tr_ msg_list* myTail = NULL;51 static struct tr_ msg_list* myHead = NULL;51 static struct tr_log_message * myTail = NULL; 52 static struct tr_log_message * myHead = NULL; 52 53 53 54 /**** … … 112 113 const gboolean pinned_to_new = is_pinned_to_new (data); 113 114 114 tr_ setMessageLevel (level);115 tr_logSetLevel (level); 115 116 gtr_core_set_pref_int (data->core, TR_KEY_message_level, level); 116 117 data->maxLevel = level; … … 155 156 char * date; 156 157 const char * levelStr; 157 const struct tr_ msg_list* node;158 const struct tr_log_message * node; 158 159 159 160 gtk_tree_model_get (model, &iter, COL_TR_MSG, &node, -1); … … 161 162 switch (node->level) 162 163 { 163 case TR_ MSG_DBG:164 case TR_LOG_DEBUG: 164 165 levelStr = "debug"; 165 166 break; 166 167 167 case TR_ MSG_ERR:168 case TR_LOG_ERROR: 168 169 levelStr = "error"; 169 170 break; … … 226 227 227 228 gtk_list_store_clear (data->store); 228 tr_ freeMessageList(myHead);229 tr_logFreeQueue (myHead); 229 230 myHead = myTail = NULL; 230 231 } … … 243 244 switch (msgLevel) 244 245 { 245 case TR_ MSG_DBG: return "forestgreen";246 case TR_ MSG_INF:return "black";247 case TR_ MSG_ERR: return "red";246 case TR_LOG_DEBUG: return "forestgreen"; 247 case TR_LOG_INFO: return "black"; 248 case TR_LOG_ERROR: return "red"; 248 249 default: g_assert_not_reached (); return "black"; 249 250 } … … 259 260 const int col = GPOINTER_TO_INT (gcol); 260 261 char * str = NULL; 261 const struct tr_ msg_list* node;262 const struct tr_log_message * node; 262 263 263 264 gtk_tree_model_get (tree_model, iter, col, &str, COL_TR_MSG, &node, -1); … … 277 278 struct tm tm; 278 279 char buf[16]; 279 const struct tr_ msg_list* node;280 const struct tr_log_message * node; 280 281 281 282 gtk_tree_model_get (tree_model, iter, COL_TR_MSG, &node, -1); … … 355 356 isRowVisible (GtkTreeModel * model, GtkTreeIter * iter, gpointer gdata) 356 357 { 357 const struct tr_ msg_list* node;358 const struct tr_log_message * node; 358 359 const struct MsgData * data = gdata; 359 360 … … 373 374 } 374 375 375 static tr_ msg_list*376 addMessages (GtkListStore * store, struct tr_ msg_list* head)377 { 378 tr_ msg_list* i;376 static tr_log_message * 377 addMessages (GtkListStore * store, struct tr_log_message * head) 378 { 379 tr_log_message * i; 379 380 static unsigned int sequence = 0; 380 381 const char * default_name = g_get_application_name (); … … 392 393 393 394 /* if it's an error message, dump it to the terminal too */ 394 if (i->level == TR_ MSG_ERR)395 if (i->level == TR_LOG_ERROR) 395 396 { 396 397 GString * gstr = g_string_sized_new (512); … … 414 415 if (!data->isPaused) 415 416 { 416 tr_ msg_list * msgs = tr_getQueuedMessages();417 tr_log_message * msgs = tr_logGetQueue (); 417 418 if (msgs) 418 419 { 419 420 /* add the new messages and append them to the end of 420 421 * our persistent list */ 421 tr_ msg_list* tail = addMessages (data->store, msgs);422 tr_log_message * tail = addMessages (data->store, msgs); 422 423 if (myTail) 423 424 myTail->next = msgs; … … 437 438 debug_level_combo_new (void) 438 439 { 439 GtkWidget * w = gtr_combo_box_new_enum (_("Error"), TR_ MSG_ERR,440 _("Information"), TR_ MSG_INF,441 _("Debug"), TR_ MSG_DBG,440 GtkWidget * w = gtr_combo_box_new_enum (_("Error"), TR_LOG_ERROR, 441 _("Information"), TR_LOG_INFO, 442 _("Debug"), TR_LOG_DEBUG, 442 443 NULL); 443 444 gtr_combo_box_set_active_enum (GTK_COMBO_BOX (w), gtr_pref_int_get (TR_KEY_message_level)); … … 522 523 G_TYPE_POINTER, /* category */ 523 524 G_TYPE_POINTER, /* message */ 524 G_TYPE_POINTER); /* struct tr_ msg_list*/525 G_TYPE_POINTER); /* struct tr_log_message */ 525 526 526 527 addMessages (data->store, myHead); -
trunk/gtk/tr-core.c
r13821 r13868 33 33 34 34 #include <libtransmission/transmission.h> 35 #include <libtransmission/log.h> 35 36 #include <libtransmission/rpcimpl.h> 36 37 #include <libtransmission/utils.h> /* tr_free */ … … 1549 1550 if (success) 1550 1551 { 1551 tr_ inf("%s", _("Inhibiting desktop hibernation"));1552 tr_logAddInfo ("%s", _("Inhibiting desktop hibernation")); 1552 1553 } 1553 1554 else 1554 1555 { 1555 tr_ err (_("Couldn't inhibit desktop hibernation: %s"), err->message);1556 tr_logAddError (_("Couldn't inhibit desktop hibernation: %s"), err->message); 1556 1557 g_error_free (err); 1557 1558 } … … 1587 1588 if (err == NULL) 1588 1589 { 1589 tr_ inf("%s", _("Allowing desktop hibernation"));1590 tr_logAddInfo ("%s", _("Allowing desktop hibernation")); 1590 1591 } 1591 1592 else -
trunk/libtransmission/Makefile.am
r13807 r13868 34 34 inout.c \ 35 35 list.c \ 36 log.c \ 36 37 magnet.c \ 37 38 makemeta.c \ … … 89 90 libtransmission-test.h \ 90 91 list.h \ 92 log.h \ 91 93 magnet.h \ 92 94 makemeta.h \ -
trunk/libtransmission/announcer-http.c
r13683 r13868 23 23 #include "transmission.h" 24 24 #include "announcer-common.h" 25 #include "log.h" 25 26 #include "net.h" /* tr_globalIPv6 () */ 26 27 #include "peer-mgr.h" /* pex */ … … 32 33 33 34 #define dbgmsg(name, ...) \ 34 if (tr_deepLoggingIsActive ()) do { \ 35 tr_deepLog (__FILE__, __LINE__, name, __VA_ARGS__); \ 36 } while (0) 35 do \ 36 { \ 37 if (tr_logGetDeepEnabled ()) \ 38 tr_logAddDeep (__FILE__, __LINE__, name, __VA_ARGS__); \ 39 } \ 40 while (0) 37 41 38 42 /**** -
trunk/libtransmission/announcer-udp.c
r13631 r13868 23 23 #include "announcer-common.h" 24 24 #include "crypto.h" /* tr_cryptoRandBuf () */ 25 #include "log.h" 25 26 #include "peer-io.h" 26 27 #include "peer-mgr.h" /* tr_peerMgrCompactToPex () */ … … 30 31 31 32 #define dbgmsg(name, ...) \ 32 if (tr_deepLoggingIsActive ()) do { \ 33 tr_deepLog (__FILE__, __LINE__, name, __VA_ARGS__); \ 34 } while (0) 33 do \ 34 { \ 35 if (tr_logGetDeepEnabled ()) \ 36 tr_logAddDeep (__FILE__, __LINE__, name, __VA_ARGS__); \ 37 } \ 38 while (0) 35 39 36 40 /**** -
trunk/libtransmission/announcer.c
r13652 r13868 26 26 #include "announcer-common.h" 27 27 #include "crypto.h" /* tr_cryptoRandInt (), tr_cryptoWeakRandInt () */ 28 #include "log.h" 28 29 #include "peer-mgr.h" /* tr_peerMgrCompactToPex () */ 29 30 #include "ptrarray.h" … … 38 39 39 40 #define dbgmsg(tier, ...) \ 40 if (tr_deepLoggingIsActive ()) do { \ 41 char name[128]; \ 42 tier_build_log_name (tier, name, sizeof (name)); \ 43 tr_deepLog (__FILE__, __LINE__, name, __VA_ARGS__); \ 44 } while (0) 41 do \ 42 { \ 43 if (tr_logGetDeepEnabled ()) \ 44 { \ 45 char name[128]; \ 46 tier_build_log_name (tier, name, sizeof (name)); \ 47 tr_logAddDeep (__FILE__, __LINE__, name, __VA_ARGS__); \ 48 } \ 49 } \ 50 while (0) 45 51 46 52 enum … … 750 756 dbgmsg_tier_announce_queue (const tr_tier * tier) 751 757 { 752 if (tr_ deepLoggingIsActive())758 if (tr_logGetDeepEnabled ()) 753 759 { 754 760 int i; … … 766 772 767 773 message = evbuffer_free_to_str (buf); 768 tr_ deepLog(__FILE__, __LINE__, name, "announce queue is %s", message);774 tr_logAddDeep (__FILE__, __LINE__, name, "announce queue is %s", message); 769 775 tr_free (message); 770 776 } … … 992 998 /* set the error message */ 993 999 dbgmsg (tier, "%s", err); 994 tr_ torinf(tier->tor, "%s", err);1000 tr_logAddTorInfo (tier->tor, "%s", err); 995 1001 tr_strlcpy (tier->lastAnnounceStr, err, sizeof (tier->lastAnnounceStr)); 996 1002 … … 1001 1007 interval = getRetryInterval (tier->currentTracker); 1002 1008 dbgmsg (tier, "Retrying announce in %d seconds.", interval); 1003 tr_ torinf(tier->tor, "Retrying announce in %d seconds.", interval);1009 tr_logAddTorInfo (tier->tor, "Retrying announce in %d seconds.", interval); 1004 1010 tier_announce_event_push (tier, e, tr_time () + interval); 1005 1011 } … … 1146 1152 if ((scrape_fields >= 3) || (!tracker->scrape && (scrape_fields >= 1))) 1147 1153 { 1148 tr_ tordbg (tier->tor, "Announce response contained scrape info; "1154 tr_logAddTorDbg (tier->tor, "Announce response contained scrape info; " 1149 1155 "rescheduling next scrape to %d seconds from now.", 1150 1156 tier->scrapeIntervalSec); … … 1206 1212 tr_tracker_udp_announce (session, request, callback, callback_data); 1207 1213 else 1208 tr_ err ("Unsupported url: %s", request->url);1214 tr_logAddError ("Unsupported url: %s", request->url); 1209 1215 1210 1216 announce_request_free (request); … … 1257 1263 /* set the error message */ 1258 1264 dbgmsg (tier, "Scrape error: %s", errmsg); 1259 tr_ torinf(tier->tor, "Scrape error: %s", errmsg);1265 tr_logAddTorInfo (tier->tor, "Scrape error: %s", errmsg); 1260 1266 tr_strlcpy (tier->lastScrapeStr, errmsg, sizeof (tier->lastScrapeStr)); 1261 1267 … … 1266 1272 interval = getRetryInterval (tier->currentTracker); 1267 1273 dbgmsg (tier, "Retrying scrape in %zu seconds.", (size_t)interval); 1268 tr_ torinf(tier->tor, "Retrying scrape in %zu seconds.", (size_t)interval);1274 tr_logAddTorInfo (tier->tor, "Retrying scrape in %zu seconds.", (size_t)interval); 1269 1275 tier->lastScrapeSucceeded = false; 1270 1276 tier->scrapeAt = get_next_scrape_time (session, tier, interval); … … 1349 1355 response->min_request_interval); 1350 1356 tier->scrapeAt = get_next_scrape_time (session, tier, tier->scrapeIntervalSec); 1351 tr_ tordbg (tier->tor, "Scrape successful. Rescraping in %d seconds.",1357 tr_logAddTorDbg (tier->tor, "Scrape successful. Rescraping in %d seconds.", 1352 1358 tier->scrapeIntervalSec); 1353 1359 … … 1385 1391 tr_tracker_udp_scrape (session, request, callback, callback_data); 1386 1392 else 1387 tr_ err ("Unsupported url: %s", request->url);1393 tr_logAddError ("Unsupported url: %s", request->url); 1388 1394 } 1389 1395 … … 1530 1536 for (i=0; i<n; ++i) { 1531 1537 tr_tier * tier = tr_ptrArrayNth (&announceMe, i); 1532 tr_ tordbg (tier->tor, "%s", "Announcing to tracker");1538 tr_logAddTorDbg (tier->tor, "%s", "Announcing to tracker"); 1533 1539 dbgmsg (tier, "announcing tier %d of %d", i, n); 1534 1540 tierAnnounce (announcer, tier); -
trunk/libtransmission/bandwidth.c
r13863 r13868 18 18 #include "bandwidth.h" 19 19 #include "crypto.h" /* tr_cryptoWeakRandInt () */ 20 #include "log.h" 20 21 #include "peer-io.h" 21 22 #include "utils.h" … … 24 25 do \ 25 26 { \ 26 if (tr_ deepLoggingIsActive()) \27 tr_ deepLog(__FILE__, __LINE__, NULL, __VA_ARGS__); \27 if (tr_logGetDeepEnabled ()) \ 28 tr_logAddDeep (__FILE__, __LINE__, NULL, __VA_ARGS__); \ 28 29 } \ 29 30 while (0) -
trunk/libtransmission/blocklist.c
r13824 r13868 36 36 #include "transmission.h" 37 37 #include "blocklist.h" 38 #include "log.h" 38 39 #include "net.h" 39 40 #include "utils.h" … … 95 96 if (fd == -1) 96 97 { 97 tr_ err (err_fmt, b->filename, tr_strerror (errno));98 tr_logAddError (err_fmt, b->filename, tr_strerror (errno)); 98 99 return; 99 100 } … … 103 104 if (!b->rules) 104 105 { 105 tr_ err (err_fmt, b->filename, tr_strerror (errno));106 tr_logAddError (err_fmt, b->filename, tr_strerror (errno)); 106 107 close (fd); 107 108 return; … … 113 114 114 115 base = tr_basename (b->filename); 115 tr_ inf(_("Blocklist \"%s\" contains %zu entries"), base, b->ruleCount);116 tr_logAddInfo (_("Blocklist \"%s\" contains %zu entries"), base, b->ruleCount); 116 117 tr_free (base); 117 118 } … … 335 336 if (in == NULL) 336 337 { 337 tr_ err (err_fmt, filename, tr_strerror (errno));338 tr_logAddError (err_fmt, filename, tr_strerror (errno)); 338 339 return 0; 339 340 } … … 344 345 if (out == NULL) 345 346 { 346 tr_ err (err_fmt, b->filename, tr_strerror (errno));347 tr_logAddError (err_fmt, b->filename, tr_strerror (errno)); 347 348 fclose (in); 348 349 return 0; … … 364 365 { 365 366 /* don't try to display the actual lines - it causes issues */ 366 tr_ err (_("blocklist skipped invalid address at line %d"), inCount);367 tr_logAddError (_("blocklist skipped invalid address at line %d"), inCount); 367 368 continue; 368 369 } … … 414 415 if (fwrite (ranges, sizeof (struct tr_ipv4_range), ranges_count, out) != ranges_count) 415 416 { 416 tr_ err (_("Couldn't save file \"%1$s\": %2$s"), b->filename, tr_strerror (errno));417 tr_logAddError (_("Couldn't save file \"%1$s\": %2$s"), b->filename, tr_strerror (errno)); 417 418 } 418 419 else 419 420 { 420 421 char * base = tr_basename (b->filename); 421 tr_ inf(_("Blocklist \"%s\" updated with %zu entries"), base, ranges_count);422 tr_logAddInfo (_("Blocklist \"%s\" updated with %zu entries"), base, ranges_count); 422 423 tr_free (base); 423 424 } -
trunk/libtransmission/cache.c
r13625 r13868 18 18 #include "cache.h" 19 19 #include "inout.h" 20 #include "log.h" 20 21 #include "peer-common.h" /* MAX_BLOCK_SIZE */ 21 22 #include "ptrarray.h" … … 28 29 do \ 29 30 { \ 30 if (tr_ deepLoggingIsActive()) \31 tr_ deepLog(__FILE__, __LINE__, MY_NAME, __VA_ARGS__); \31 if (tr_logGetDeepEnabled ()) \ 32 tr_logAddDeep (__FILE__, __LINE__, MY_NAME, __VA_ARGS__); \ 32 33 } \ 33 34 while (0) … … 260 261 261 262 tr_formatter_mem_B (buf, cache->max_bytes, sizeof (buf)); 262 tr_ ndbg (MY_NAME, "Maximum cache size set to %s (%d blocks)", buf, cache->max_blocks);263 tr_logAddNamedDbg (MY_NAME, "Maximum cache size set to %s (%d blocks)", buf, cache->max_blocks); 263 264 264 265 return cacheTrim (cache); -
trunk/libtransmission/crypto.c
r13863 r13868 27 27 #include "transmission.h" 28 28 #include "crypto.h" 29 #include "log.h" 29 30 #include "utils.h" 30 31 … … 84 85 #define logErrorFromSSL(...) \ 85 86 do { \ 86 if (tr_ msgLoggingIsActive (TR_MSG_ERR)) { \87 if (tr_logLevelIsActive (TR_LOG_ERROR)) { \ 87 88 char buf[512]; \ 88 89 ERR_error_string_n (ERR_get_error (), buf, sizeof (buf)); \ 89 tr_ msg (__FILE__, __LINE__, TR_MSG_ERR, MY_NAME, "%s", buf); \90 tr_logAddMessage (__FILE__, __LINE__, TR_LOG_ERROR, MY_NAME, "%s", buf); \ 90 91 } \ 91 92 } while (0) -
trunk/libtransmission/fdlimit.c
r13803 r13868 44 44 #include "transmission.h" 45 45 #include "fdlimit.h" 46 #include " net.h"46 #include "log.h" 47 47 #include "session.h" 48 48 #include "torrent.h" /* tr_isTorrent () */ 49 49 50 50 #define dbgmsg(...) \ 51 do { \ 52 if (tr_deepLoggingIsActive ()) \ 53 tr_deepLog (__FILE__, __LINE__, NULL, __VA_ARGS__); \ 54 } while (0) 51 do \ 52 { \ 53 if (tr_logGetDeepEnabled ()) \ 54 tr_logAddDeep (__FILE__, __LINE__, NULL, __VA_ARGS__); \ 55 } \ 56 while (0) 55 57 56 58 /*** … … 343 345 if (err) 344 346 { 345 tr_ err (_("Couldn't create \"%1$s\": %2$s"), dir, tr_strerror (err));347 tr_logAddError (_("Couldn't create \"%1$s\": %2$s"), dir, tr_strerror (err)); 346 348 tr_free (dir); 347 349 return err; … … 354 356 if (writable && !alreadyExisted && (allocation == TR_PREALLOCATE_FULL)) 355 357 if (preallocate_file_full (filename, file_size)) 356 tr_ dbg ("Preallocated file \"%s\"", filename);358 tr_logAddDebug ("Preallocated file \"%s\"", filename); 357 359 358 360 /* open the file */ … … 364 366 { 365 367 const int err = errno; 366 tr_ err (_("Couldn't open \"%1$s\": %2$s"), filename, tr_strerror (err));368 tr_logAddError (_("Couldn't open \"%1$s\": %2$s"), filename, tr_strerror (err)); 367 369 return err; 368 370 } … … 379 381 { 380 382 const int err = errno; 381 tr_ err (_("Couldn't truncate \"%1$s\": %2$s"), filename, tr_strerror (err));383 tr_logAddError (_("Couldn't truncate \"%1$s\": %2$s"), filename, tr_strerror (err)); 382 384 return err; 383 385 } … … 524 526 setrlimit (RLIMIT_NOFILE, &limit); 525 527 getrlimit (RLIMIT_NOFILE, &limit); 526 tr_ inf("Changed open file limit from %d to %d", old_limit, (int)limit.rlim_cur);528 tr_logAddInfo ("Changed open file limit from %d to %d", old_limit, (int)limit.rlim_cur); 527 529 } 528 530 } … … 666 668 if ((s = socket (domain, type, 0)) < 0) 667 669 if (sockerrno != EAFNOSUPPORT) 668 tr_ err (_("Couldn't create socket: %s"), tr_strerror (sockerrno));670 tr_logAddError (_("Couldn't create socket: %s"), tr_strerror (sockerrno)); 669 671 670 672 if (s > -1) … … 682 684 buf_logged = true; 683 685 getsockopt (s, SOL_SOCKET, SO_SNDBUF, &i, &size); 684 tr_ dbg ("SO_SNDBUF size is %d", i);686 tr_logAddDebug ("SO_SNDBUF size is %d", i); 685 687 getsockopt (s, SOL_SOCKET, SO_RCVBUF, &i, &size); 686 tr_ dbg ("SO_RCVBUF size is %d", i);688 tr_logAddDebug ("SO_RCVBUF size is %d", i); 687 689 } 688 690 } -
trunk/libtransmission/handshake.c
r13702 r13868 22 22 #include "crypto.h" 23 23 #include "handshake.h" 24 #include "log.h" 24 25 #include "peer-io.h" 25 26 #include "peer-mgr.h" … … 149 150 #define dbgmsg(handshake, ...) \ 150 151 do { \ 151 if (tr_ deepLoggingIsActive()) \152 tr_ deepLog(__FILE__, __LINE__, tr_peerIoGetAddrStr (handshake->io), __VA_ARGS__); \152 if (tr_logGetDeepEnabled ()) \ 153 tr_logAddDeep (__FILE__, __LINE__, tr_peerIoGetAddrStr (handshake->io), __VA_ARGS__); \ 153 154 } while (0) 154 155 -
trunk/libtransmission/inout.c
r13625 r13868 22 22 #include "fdlimit.h" 23 23 #include "inout.h" 24 #include "log.h" 24 25 #include "peer-common.h" /* MAX_BLOCK_SIZE */ 25 26 #include "stats.h" /* tr_statsFileCreated () */ … … 100 101 { 101 102 err = errno; 102 tr_ torerr (tor, "tr_fdFileCheckout failed for \"%s\": %s",103 tr_logAddTorErr (tor, "tr_fdFileCheckout failed for \"%s\": %s", 103 104 filename, tr_strerror (err)); 104 105 } … … 127 128 { 128 129 err = errno; 129 tr_ torerr (tor, "read failed for \"%s\": %s", file->name, tr_strerror (err));130 tr_logAddTorErr (tor, "read failed for \"%s\": %s", file->name, tr_strerror (err)); 130 131 } 131 132 } … … 136 137 { 137 138 err = errno; 138 tr_ torerr (tor, "write failed for \"%s\": %s", file->name, tr_strerror (err));139 tr_logAddTorErr (tor, "write failed for \"%s\": %s", file->name, tr_strerror (err)); 139 140 } 140 141 } -
trunk/libtransmission/libtransmission-test.c
r13825 r13868 229 229 tr_variantDictAddBool (&dict, TR_KEY_port_forwarding_enabled, false); 230 230 tr_variantDictAddBool (&dict, TR_KEY_dht_enabled, false); 231 tr_variantDictAddInt (&dict, TR_KEY_message_level, verbose ? TR_ MSG_DBG : TR_MSG_ERR);231 tr_variantDictAddInt (&dict, TR_KEY_message_level, verbose ? TR_LOG_DEBUG : TR_LOG_ERROR); 232 232 session = tr_sessionInit ("libtransmission-test", sandbox, !verbose, &dict); 233 233 … … 248 248 { 249 249 tr_sessionClose (session); 250 tr_ freeMessageList (tr_getQueuedMessages());250 tr_logFreeQueue (tr_logGetQueue ()); 251 251 session = NULL; 252 252 -
trunk/libtransmission/makemeta.c
r13865 r13868 27 27 #include "crypto.h" /* tr_sha1 */ 28 28 #include "fdlimit.h" /* tr_open_file_for_scanning () */ 29 #include "log.h" 29 30 #include "session.h" 30 31 #include "makemeta.h" … … 61 62 if (i) 62 63 { 63 tr_ err (_("Torrent Creator is skipping file \"%s\": %s"),64 tr_logAddError (_("Torrent Creator is skipping file \"%s\": %s"), 64 65 buf, tr_strerror (errno)); 65 66 tr_free (buf); -
trunk/libtransmission/metainfo.c
r13829 r13868 24 24 #include "session.h" 25 25 #include "crypto.h" /* tr_sha1 */ 26 #include "log.h" 26 27 #include "metainfo.h" 27 28 #include "platform.h" /* tr_getTorrentDir () */ … … 543 544 if (badTag) 544 545 { 545 tr_ nerr (inf->name, _("Invalid metadata entry \"%s\""), badTag);546 tr_logAddNamedError (inf->name, _("Invalid metadata entry \"%s\""), badTag); 546 547 tr_metainfoFree (inf); 547 548 } -
trunk/libtransmission/natpmp.c
r13631 r13868 22 22 #include "transmission.h" 23 23 #include "natpmp_local.h" 24 #include "log.h" 24 25 #include "net.h" /* tr_netCloseSocket */ 25 26 #include "port-forwarding.h" … … 70 71 return; 71 72 if (ret >= 0) 72 tr_ ninf(getKey (), _("%s succeeded (%d)"), func, ret);73 tr_logAddNamedInfo (getKey (), _("%s succeeded (%d)"), func, ret); 73 74 else 74 tr_ ndbg (75 tr_logAddNamedDbg ( 75 76 getKey (), 76 77 "%s failed. Natpmp returned %d (%s); errno is %d (%s)", … … 139 140 char str[128]; 140 141 evutil_inet_ntop (AF_INET, &response.pnu.publicaddress.addr, str, sizeof (str)); 141 tr_ ninf(getKey (), _("Found public address \"%s\""), str);142 tr_logAddNamedInfo (getKey (), _("Found public address \"%s\""), str); 142 143 nat->state = TR_NATPMP_IDLE; 143 144 } … … 174 175 const int private_port = resp.pnu.newportmapping.privateport; 175 176 176 tr_ ninf(getKey (), _("no longer forwarding port %d"), private_port);177 tr_logAddNamedInfo (getKey (), _("no longer forwarding port %d"), private_port); 177 178 178 179 if (nat->private_port == private_port) … … 219 220 nat->private_port = resp.pnu.newportmapping.privateport; 220 221 nat->public_port = resp.pnu.newportmapping.mappedpublicport; 221 tr_ ninf(getKey (), _("Port %d forwarded successfully"), nat->private_port);222 tr_logAddNamedInfo (getKey (), _("Port %d forwarded successfully"), nat->private_port); 222 223 } 223 224 else if (val != NATPMP_TRYAGAIN) -
trunk/libtransmission/net.c
r13631 r13868 47 47 #include "session.h" /* tr_sessionGetPublicAddress () */ 48 48 #include "tr-utp.h" /* tr_utpSendTo () */ 49 #include "utils.h" /* tr_time (), tr_dbg () */ 49 #include "log.h" 50 #include "utils.h" /* tr_time (), tr_logAddDebug () */ 50 51 51 52 #ifndef IN_MULTICAST … … 250 251 int n = 8192; 251 252 if (setsockopt (s, SOL_SOCKET, SO_RCVBUF, &n, sizeof (n))) 252 tr_ inf("Unable to set SO_RCVBUF on socket %d: %s", s, tr_strerror (sockerrno));253 tr_logAddInfo ("Unable to set SO_RCVBUF on socket %d: %s", s, tr_strerror (sockerrno)); 253 254 } 254 255 … … 266 267 if (bind (s, (struct sockaddr *) &source_sock, sourcelen)) 267 268 { 268 tr_ err (_("Couldn't set source address %s on %d: %s"),269 tr_logAddError (_("Couldn't set source address %s on %d: %s"), 269 270 tr_address_to_string (source_addr), s, tr_strerror (errno)); 270 271 return -errno; … … 282 283 if ((tmperrno != ENETUNREACH && tmperrno != EHOSTUNREACH) 283 284 || addr->type == TR_AF_INET) 284 tr_ err (_("Couldn't connect socket %d to %s, port %d (errno %d - %s)"),285 tr_logAddError (_("Couldn't connect socket %d to %s, port %d (errno %d - %s)"), 285 286 s, tr_address_to_string (addr), (int)ntohs (port), tmperrno, 286 287 tr_strerror (tmperrno)); … … 289 290 } 290 291 291 tr_ deepLog(__FILE__, __LINE__, NULL, "New OUTGOING connection %d (%s)",292 s, tr_peerIoAddrStr (addr, port));292 tr_logAddDeep (__FILE__, __LINE__, NULL, "New OUTGOING connection %d (%s)", 293 s, tr_peerIoAddrStr (addr, port)); 293 294 294 295 return s; … … 367 368 fmt = _("Couldn't bind port %d on %s: %s (%s)"); 368 369 369 tr_ err (fmt, port, tr_address_to_string (addr), tr_strerror (err), hint);370 tr_logAddError (fmt, port, tr_address_to_string (addr), tr_strerror (err), hint); 370 371 } 371 372 tr_netCloseSocket (fd); … … 375 376 376 377 if (!suppressMsgs) 377 tr_ dbg ("Bound socket %d to port %d on %s", fd, port, tr_address_to_string (addr));378 tr_logAddDebug ("Bound socket %d to port %d on %s", fd, port, tr_address_to_string (addr)); 378 379 379 380 if (listen (fd, 128) == -1) { -
trunk/libtransmission/peer-io.c
r13667 r13868 25 25 #include "bandwidth.h" 26 26 #include "crypto.h" 27 #include "log.h" 27 28 #include "net.h" 28 29 #include "peer-common.h" /* MAX_BLOCK_SIZE */ … … 73 74 74 75 #define dbgmsg(io, ...) \ 75 do { \ 76 if (tr_deepLoggingIsActive ()) \ 77 tr_deepLog (__FILE__, __LINE__, tr_peerIoGetAddrStr (io), __VA_ARGS__); \ 78 } while (0) 76 do \ 77 { \ 78 if (tr_logGetDeepEnabled ()) \ 79 tr_logAddDeep (__FILE__, __LINE__, tr_peerIoGetAddrStr (io), __VA_ARGS__); \ 80 } \ 81 while (0) 79 82 80 83 /** … … 398 401 399 402 if (rc < 0) 400 tr_ ninf("Net", "Can't set congestion control algorithm '%s': %s",403 tr_logAddNamedInfo ("Net", "Can't set congestion control algorithm '%s': %s", 401 404 algorithm, tr_strerror (errno)); 402 405 } … … 417 420 418 421 if (rc < 0) { 419 tr_ nerr ("UTP", "On read evbuffer_add");422 tr_logAddNamedError ("UTP", "On read evbuffer_add"); 420 423 return; 421 424 } … … 436 439 assert (rc == (int)buflen); /* if this fails, we've corrupted our bookkeeping somewhere */ 437 440 if (rc < (long)buflen) { 438 tr_ nerr ("UTP", "Short write: %d < %ld", rc, (long)buflen);441 tr_logAddNamedError ("UTP", "Short write: %d < %ld", rc, (long)buflen); 439 442 } 440 443 … … 485 488 io->gotError (io, BEV_EVENT_EOF, io->userData); 486 489 } else if (state == UTP_STATE_DESTROYING) { 487 tr_ nerr ("UTP", "Impossible state UTP_STATE_DESTROYING");490 tr_logAddNamedError ("UTP", "Impossible state UTP_STATE_DESTROYING"); 488 491 return; 489 492 } else { 490 tr_ nerr ("UTP", "Unknown state %d", state);493 tr_logAddNamedError ("UTP", "Unknown state %d", state); 491 494 } 492 495 } … … 536 539 { 537 540 /* This cannot happen, as far as I'm aware. */ 538 tr_ nerr ("UTP", "On_read called on closed socket");541 tr_logAddNamedError ("UTP", "On_read called on closed socket"); 539 542 540 543 } … … 545 548 /* This can very well happen if we've shut down a peer connection that 546 549 had unflushed buffers. Complain and send zeroes. */ 547 tr_ ndbg ("UTP", "On_write called on closed socket");550 tr_logAddNamedDbg ("UTP", "On_write called on closed socket"); 548 551 memset (buf, 0, buflen); 549 552 } -
trunk/libtransmission/peer-mgr.c
r13863 r13868 30 30 #include "crypto.h" 31 31 #include "handshake.h" 32 #include "log.h" 32 33 #include "net.h" 33 34 #include "peer-io.h" … … 238 239 do \ 239 240 { \ 240 if (tr_ deepLoggingIsActive()) \241 tr_ deepLog(__FILE__, __LINE__, tr_torrentName (t->tor), __VA_ARGS__); \241 if (tr_logGetDeepEnabled ()) \ 242 tr_logAddDeep (__FILE__, __LINE__, tr_torrentName (t->tor), __VA_ARGS__); \ 242 243 } \ 243 244 while (0) … … 246 247 do \ 247 248 { \ 248 if (tr_ deepLoggingIsActive()) \249 tr_ deepLog(__FILE__, __LINE__, NULL, __VA_ARGS__); \249 if (tr_logGetDeepEnabled ()) \ 250 tr_logAddDeep (__FILE__, __LINE__, NULL, __VA_ARGS__); \ 250 251 } \ 251 252 while (0) … … 1806 1807 if (!ok) 1807 1808 { 1808 tr_ torerr (tor, _("Piece %lu, which was just downloaded, failed its checksum test"),1809 tr_logAddTorErr (tor, _("Piece %lu, which was just downloaded, failed its checksum test"), 1809 1810 (unsigned long)p); 1810 1811 } … … 2092 2093 if (tr_sessionIsAddressBlocked (session, addr)) 2093 2094 { 2094 tr_ dbg ("Banned IP address \"%s\" tried to connect to us", tr_address_to_string (addr));2095 tr_logAddDebug ("Banned IP address \"%s\" tried to connect to us", tr_address_to_string (addr)); 2095 2096 if (socket >= 0) 2096 2097 tr_netClose (session, socket); -
trunk/libtransmission/peer-msgs.c
r13782 r13868 25 25 #include "completion.h" 26 26 #include "crypto.h" /* tr_sha1 () */ 27 #include "log.h" 27 28 #include "peer-io.h" 28 29 #include "peer-mgr.h" … … 235 236 const char * fmt, ...) 236 237 { 237 FILE * fp = tr_ getLog();238 FILE * fp = tr_logGetFile (); 238 239 239 240 if (fp) … … 246 247 247 248 evbuffer_add_printf (buf, "[%s] %s - %s [%s]: ", 248 tr_ getLogTimeStr (timestr, sizeof (timestr)),249 tr_logGetTimeStr (timestr, sizeof (timestr)), 249 250 tr_torrentName (msgs->torrent), 250 251 tr_peerIoGetAddrStr (msgs->peer->io), … … 266 267 do \ 267 268 { \ 268 if (tr_ deepLoggingIsActive()) \269 if (tr_logGetDeepEnabled ()) \ 269 270 myDebug (__FILE__, __LINE__, msgs, __VA_ARGS__); \ 270 271 } \ -
trunk/libtransmission/platform.c
r13754 r13868 76 76 #include "session.h" 77 77 #include "list.h" 78 #include "log.h" 78 79 #include "platform.h" 79 80 #include "utils.h" … … 379 380 380 381 if (count) 381 tr_ inf(_("Migrated %1$d files from \"%2$s\" to \"%3$s\""), count, oldDir, newDir);382 tr_logAddInfo (_("Migrated %1$d files from \"%2$s\" to \"%3$s\""), count, oldDir, newDir); 382 383 383 384 closedir (dirh); … … 556 557 char * tmp = tr_buildPath (path, "index.html", NULL); 557 558 const int ret = !stat (tmp, &sb); 558 tr_ inf(_("Searching for web interface file \"%s\""), tmp);559 tr_logAddInfo (_("Searching for web interface file \"%s\""), tmp); 559 560 tr_free (tmp); 560 561 -
trunk/libtransmission/port-forwarding.c
r13863 r13868 20 20 #include "transmission.h" 21 21 #include "natpmp_local.h" 22 #include "log.h" 22 23 #include "net.h" 23 24 #include "peer-mgr.h" … … 90 91 91 92 if (newStatus != oldStatus) 92 tr_ ninf(getKey (), _("State changed from \"%1$s\" to \"%2$s\""),93 tr_logAddNamedInfo (getKey (), _("State changed from \"%1$s\" to \"%2$s\""), 93 94 getNatStateStr (oldStatus), 94 95 getNatStateStr (newStatus)); … … 180 181 stop_forwarding (tr_shared * s) 181 182 { 182 tr_ ninf(getKey (), "%s", _("Stopped"));183 tr_logAddNamedInfo (getKey (), "%s", _("Stopped")); 183 184 natPulse (s, false); 184 185 -
trunk/libtransmission/resume.c
r13829 r13868 17 17 #include "transmission.h" 18 18 #include "completion.h" 19 #include "log.h" 19 20 #include "metainfo.h" /* tr_metainfoGetBasename () */ 20 21 #include "peer-mgr.h" /* pex */ … … 95 96 { 96 97 const int numAdded = addPeers (tor, str, len); 97 tr_ tordbg (tor, "Loaded %d IPv4 peers from resume file", numAdded);98 tr_logAddTorDbg (tor, "Loaded %d IPv4 peers from resume file", numAdded); 98 99 ret = TR_FR_PEERS; 99 100 } … … 102 103 { 103 104 const int numAdded = addPeers (tor, str, len); 104 tr_ tordbg (tor, "Loaded %d IPv6 peers from resume file", numAdded);105 tr_logAddTorDbg (tor, "Loaded %d IPv6 peers from resume file", numAdded); 105 106 ret = TR_FR_PEERS; 106 107 } … … 152 153 { 153 154 tr_torrentInitFileDLs (tor, dnd, dndCount, false); 154 tr_ tordbg (tor, "Resume file found %d files listed as dnd",155 tr_logAddTorDbg (tor, "Resume file found %d files listed as dnd", 155 156 dndCount); 156 157 } … … 158 159 { 159 160 tr_torrentInitFileDLs (tor, dl, dlCount, true); 160 tr_ tordbg (tor,161 tr_logAddTorDbg (tor, 161 162 "Resume file found %d files marked for download", 162 163 dlCount); … … 169 170 else 170 171 { 171 tr_ tordbg (172 tr_logAddTorDbg ( 172 173 tor, 173 174 "Couldn't load DND flags. DND list (%p) has %zu children; torrent has %d files", … … 630 631 631 632 if (err != NULL) 632 tr_ tordbg (tor, "Torrent needs to be verified - %s", err);633 tr_logAddTorDbg (tor, "Torrent needs to be verified - %s", err); 633 634 else 634 635 tr_cpBlockInit (&tor->completion, &blocks); … … 709 710 if (tr_variantFromFile (&top, TR_VARIANT_FMT_BENC, filename)) 710 711 { 711 tr_ tordbg (tor, "Couldn't read \"%s\"", filename);712 tr_logAddTorDbg (tor, "Couldn't read \"%s\"", filename); 712 713 713 714 tr_free (filename); … … 715 716 } 716 717 717 tr_ tordbg (tor, "Read resume file \"%s\"", filename);718 tr_logAddTorDbg (tor, "Read resume file \"%s\"", filename); 718 719 719 720 if ((fieldsToLoad & TR_FR_CORRUPT) -
trunk/libtransmission/rpc-server.c
r13683 r13868 31 31 #include "fdlimit.h" 32 32 #include "list.h" 33 #include "log.h" 33 34 #include "net.h" 34 35 #include "platform.h" /* tr_getWebClientDir () */ … … 79 80 #define dbgmsg(...) \ 80 81 do { \ 81 if (tr_ deepLoggingIsActive()) \82 tr_ deepLog(__FILE__, __LINE__, MY_NAME, __VA_ARGS__); \82 if (tr_logGetDeepEnabled ()) \ 83 tr_logAddDeep (__FILE__, __LINE__, MY_NAME, __VA_ARGS__); \ 83 84 } while (0) 84 85 … … 799 800 tr_list_append (&server->whitelist, token); 800 801 if (strcspn (token, "+-") < len) 801 tr_ ninf(MY_NAME, "Adding address to whitelist: %s (And it has a '+' or '-'! Are you using an old ACL by mistake?)", token);802 tr_logAddNamedInfo (MY_NAME, "Adding address to whitelist: %s (And it has a '+' or '-'! Are you using an old ACL by mistake?)", token); 802 803 else 803 tr_ ninf(MY_NAME, "Adding address to whitelist: %s", token);804 tr_logAddNamedInfo (MY_NAME, "Adding address to whitelist: %s", token); 804 805 805 806 if (walk[len]=='\0') … … 923 924 { 924 925 const char * str = tr_quark_get_string (q, NULL); 925 tr_ nerr (MY_NAME, _("Couldn't find settings key \"%s\""), str);926 tr_logAddNamedError (MY_NAME, _("Couldn't find settings key \"%s\""), str); 926 927 } 927 928 … … 992 993 address = tr_inaddr_any; 993 994 } else if (!tr_address_from_string (&address, str)) { 994 tr_ nerr (MY_NAME, _("%s is not a valid address"), str);995 tr_logAddNamedError (MY_NAME, _("%s is not a valid address"), str); 995 996 address = tr_inaddr_any; 996 997 } else if (address.type != TR_AF_INET) { 997 tr_ nerr (MY_NAME, _("%s is not an IPv4 address. RPC listeners must be IPv4"), str);998 tr_logAddNamedError (MY_NAME, _("%s is not an IPv4 address. RPC listeners must be IPv4"), str); 998 999 address = tr_inaddr_any; 999 1000 } … … 1002 1003 if (s->isEnabled) 1003 1004 { 1004 tr_ ninf(MY_NAME, _("Serving RPC and Web requests on port 127.0.0.1:%d%s"), (int) s->port, s->url);1005 tr_logAddNamedInfo (MY_NAME, _("Serving RPC and Web requests on port 127.0.0.1:%d%s"), (int) s->port, s->url); 1005 1006 tr_runInEventThread (session, startServer, s); 1006 1007 1007 1008 if (s->isWhitelistEnabled) 1008 tr_ ninf(MY_NAME, "%s", _("Whitelist enabled"));1009 tr_logAddNamedInfo (MY_NAME, "%s", _("Whitelist enabled")); 1009 1010 1010 1011 if (s->isPasswordEnabled) 1011 tr_ ninf(MY_NAME, "%s", _("Password required"));1012 tr_logAddNamedInfo (MY_NAME, "%s", _("Password required")); 1012 1013 } 1013 1014 -
trunk/libtransmission/rpcimpl.c
r13815 r13868 27 27 #include "completion.h" 28 28 #include "fdlimit.h" 29 #include "log.h" 29 30 #include "rpcimpl.h" 30 31 #include "session.h" … … 50 51 #else 51 52 #define dbgmsg(...) \ 52 do { \ 53 if (tr_deepLoggingIsActive ()) \ 54 tr_deepLog (__FILE__, __LINE__, "RPC", __VA_ARGS__); \ 55 } while (0) 53 do \ 54 { \ 55 if (tr_logGetDeepEnabled ()) \ 56 tr_logAddDeep (__FILE__, __LINE__, "RPC", __VA_ARGS__); \ 57 } \ 58 while (0) 56 59 #endif 57 60 … … 1480 1483 1481 1484 if (*result) 1482 tr_ err ("%s", result);1485 tr_logAddError ("%s", result); 1483 1486 else { 1484 1487 /* feed it to the session and give the client a response */ -
trunk/libtransmission/session.c
r13847 r13868 36 36 #include "fdlimit.h" 37 37 #include "list.h" 38 #include "log.h" 38 39 #include "net.h" 39 40 #include "peer-io.h" … … 72 73 do \ 73 74 { \ 74 if (tr_ deepLoggingIsActive()) \75 tr_ deepLog(__FILE__, __LINE__, NULL, __VA_ARGS__); \75 if (tr_logGetDeepEnabled ()) \ 76 tr_logAddDeep (__FILE__, __LINE__, NULL, __VA_ARGS__); \ 76 77 } \ 77 78 while (0) … … 186 187 clientSocket = tr_netAccept (session, fd, &clientAddr, &clientPort); 187 188 if (clientSocket > 0) { 188 tr_ deepLog(__FILE__, __LINE__, NULL, "new incoming connection %d (%s)",189 clientSocket, tr_peerIoAddrStr (&clientAddr, clientPort));189 tr_logAddDeep (__FILE__, __LINE__, NULL, "new incoming connection %d (%s)", 190 clientSocket, tr_peerIoAddrStr (&clientAddr, clientPort)); 190 191 tr_peerMgrAddIncoming (session->peerMgr, &clientAddr, clientPort, 191 192 clientSocket, NULL); … … 323 324 tr_variantDictAddStr (d, TR_KEY_incomplete_dir, tr_getDefaultDownloadDir ()); 324 325 tr_variantDictAddBool (d, TR_KEY_incomplete_dir_enabled, false); 325 tr_variantDictAddInt (d, TR_KEY_message_level, TR_ MSG_INF);326 tr_variantDictAddInt (d, TR_KEY_message_level, TR_LOG_INFO); 326 327 tr_variantDictAddInt (d, TR_KEY_download_queue_size, 5); 327 328 tr_variantDictAddBool (d, TR_KEY_download_queue_enabled, true); … … 395 396 tr_variantDictAddStr (d, TR_KEY_incomplete_dir, tr_sessionGetIncompleteDir (s)); 396 397 tr_variantDictAddBool (d, TR_KEY_incomplete_dir_enabled, tr_sessionIsIncompleteDirEnabled (s)); 397 tr_variantDictAddInt (d, TR_KEY_message_level, tr_ getMessageLevel ());398 tr_variantDictAddInt (d, TR_KEY_message_level, tr_logGetLevel ()); 398 399 tr_variantDictAddInt (d, TR_KEY_peer_limit_global, s->peerLimit); 399 400 tr_variantDictAddInt (d, TR_KEY_peer_limit_per_torrent, s->peerLimitPerTorrent); … … 544 545 545 546 if (tr_cacheFlushDone (session->cache)) 546 tr_ err ("Error while flushing completed pieces from cache");547 tr_logAddError ("Error while flushing completed pieces from cache"); 547 548 548 549 while ((tor = tr_torrentNext (session, tor))) … … 597 598 /* nice to start logging at the very beginning */ 598 599 if (tr_variantDictFindInt (clientSettings, TR_KEY_message_level, &i)) 599 tr_ setMessageLevel (i);600 tr_logSetLevel (i); 600 601 601 602 /* start the libtransmission thread */ … … 695 696 #endif 696 697 697 tr_ setMessageQueuing(data->messageQueuingEnabled);698 tr_logSetQueueEnabled (data->messageQueuingEnabled); 698 699 699 700 tr_setConfigDir (session, data->configDir); … … 723 724 /* first %s is the application name 724 725 second %s is the version number */ 725 tr_ inf(_("%s %s started"), TR_NAME, LONG_VERSION_STRING);726 tr_logAddInfo (_("%s %s started"), TR_NAME, LONG_VERSION_STRING); 726 727 727 728 tr_statsInit (session); … … 764 765 765 766 if (tr_variantDictFindInt (settings, TR_KEY_message_level, &i)) 766 tr_ setMessageLevel (i);767 tr_logSetLevel (i); 767 768 768 769 if (tr_variantDictFindInt (settings, TR_KEY_umask, &i)) { … … 1372 1373 if (!alreadySwitched) 1373 1374 { 1374 tr_ inf("Time to turn %s turtle mode!", (enabled?"on":"off"));1375 tr_logAddInfo ("Time to turn %s turtle mode!", (enabled?"on":"off")); 1375 1376 t->autoTurtleState = newAutoTurtleState; 1376 1377 useAltSpeed (s, t, enabled, false); … … 1494 1495 userPokedTheClock (tr_session * s, struct tr_turtle_info * t) 1495 1496 { 1496 tr_ dbg ("Refreshing the turtle mode clock due to user changes");1497 tr_logAddDebug ("Refreshing the turtle mode clock due to user changes"); 1497 1498 1498 1499 t->autoTurtleState = TR_AUTO_SWITCH_UNUSED; … … 1948 1949 1949 1950 if (n) 1950 tr_ inf(_("Loaded %d torrents"), n);1951 tr_logAddInfo (_("Loaded %d torrents"), n); 1951 1952 1952 1953 if (data->setmeCount) … … 2444 2445 2445 2446 session->metainfoLookup = lookup; 2446 tr_ dbg ("Found %d torrents in \"%s\"", n, dirname);2447 tr_logAddDebug ("Found %d torrents in \"%s\"", n, dirname); 2447 2448 } 2448 2449 -
trunk/libtransmission/stats.c
r13683 r13868 13 13 #include "transmission.h" 14 14 #include "session.h" 15 #include "log.h" 15 16 #include "platform.h" /* tr_sessionGetConfigDir () */ 16 17 #include "stats.h" … … 96 97 97 98 filename = getFilename (session); 98 tr_ deepLog(__FILE__, __LINE__, NULL, "Saving stats to \"%s\"", filename);99 tr_logAddDeep (__FILE__, __LINE__, NULL, "Saving stats to \"%s\"", filename); 99 100 tr_variantToFile (&top, TR_VARIANT_FMT_JSON, filename); 100 101 -
trunk/libtransmission/torrent-magnet.c
r13829 r13868 19 19 #include "transmission.h" 20 20 #include "crypto.h" /* tr_sha1 () */ 21 #include "log.h" 21 22 #include "magnet.h" 22 23 #include "metainfo.h" … … 31 32 do \ 32 33 { \ 33 if (tr_ deepLoggingIsActive()) \34 tr_ deepLog(__FILE__, __LINE__, tr_torrentName (tor), __VA_ARGS__); \34 if (tr_logGetDeepEnabled ()) \ 35 tr_logAddDeep (__FILE__, __LINE__, tr_torrentName (tor), __VA_ARGS__); \ 35 36 } \ 36 37 while (0) … … 315 316 dbgmsg (tor, "metadata error; trying again. %d pieces left", n); 316 317 317 tr_ err ("magnet status: checksum passed %d, metainfo parsed %d",318 tr_logAddError ("magnet status: checksum passed %d, metainfo parsed %d", 318 319 (int)checksumPassed, (int)metainfoParsed); 319 320 } -
trunk/libtransmission/torrent.c
r13856 r13868 41 41 #include "fdlimit.h" /* tr_fdTorrentClose */ 42 42 #include "inout.h" /* tr_ioTestPiece () */ 43 #include "log.h" 43 44 #include "magnet.h" 44 45 #include "metainfo.h" … … 63 64 do \ 64 65 { \ 65 if (tr_ deepLoggingIsActive()) \66 tr_ deepLog(__FILE__, __LINE__, tr_torrentName (tor), __VA_ARGS__); \66 if (tr_logGetDeepEnabled ()) \ 67 tr_logAddDeep (__FILE__, __LINE__, tr_torrentName (tor), __VA_ARGS__); \ 67 68 } \ 68 69 while (0) … … 456 457 if (tr_torrentIsSeedRatioDone (tor)) 457 458 { 458 tr_ torinf(tor, "%s", "Seed ratio reached; pausing torrent");459 tr_logAddTorInfo (tor, "%s", "Seed ratio reached; pausing torrent"); 459 460 460 461 tor->isStopping = true; … … 467 468 else if (tr_torrentIsSeedIdleLimitDone (tor)) 468 469 { 469 tr_ torinf(tor, "%s", "Seeding idle limit reached; pausing torrent");470 tr_logAddTorInfo (tor, "%s", "Seeding idle limit reached; pausing torrent"); 470 471 471 472 tor->isStopping = true; … … 495 496 va_end (ap); 496 497 497 tr_ torerr (tor, "%s", tor->errorString);498 tr_logAddTorErr (tor, "%s", tor->errorString); 498 499 499 500 if (tor->isRunning) … … 521 522 522 523 if (allAreSeeds) 523 tr_ tordbg (tor, "Got %zu seeds from tracker", event->pexCount);524 tr_logAddTorDbg (tor, "Got %zu seeds from tracker", event->pexCount); 524 525 else 525 tr_ tordbg (tor, "Got %zu peers from tracker", event->pexCount);526 tr_logAddTorDbg (tor, "Got %zu peers from tracker", event->pexCount); 526 527 527 528 for (i = 0; i < event->pexCount; ++i) … … 532 533 533 534 case TR_TRACKER_WARNING: 534 tr_ torerr (tor, _("Tracker warning: \"%s\""), event->text);535 tr_logAddTorErr (tor, _("Tracker warning: \"%s\""), event->text); 535 536 tor->error = TR_STAT_TRACKER_WARNING; 536 537 tr_strlcpy (tor->errorTracker, event->tracker, sizeof (tor->errorTracker)); … … 539 540 540 541 case TR_TRACKER_ERROR: 541 tr_ torerr (tor, _("Tracker error: \"%s\""), event->text);542 tr_logAddTorErr (tor, _("Tracker error: \"%s\""), event->text); 542 543 tor->error = TR_STAT_TRACKER_ERROR; 543 544 tr_strlcpy (tor->errorTracker, event->tracker, sizeof (tor->errorTracker)); … … 1651 1652 /* allow finished torrents to be resumed */ 1652 1653 if (tr_torrentIsSeedRatioDone (tor)) { 1653 tr_ torinf(tor, "%s", _("Restarted manually -- disabling its seed ratio"));1654 tr_logAddTorInfo (tor, "%s", _("Restarted manually -- disabling its seed ratio")); 1654 1655 tr_torrentSetRatioMode (tor, TR_RATIOLIMIT_UNLIMITED); 1655 1656 } … … 1756 1757 { 1757 1758 tr_torrent * tor = vtor; 1758 tr_ torinf(tor, "%s", "Pausing");1759 tr_logAddTorInfo (tor, "%s", "Pausing"); 1759 1760 1760 1761 assert (tr_isTorrent (tor)); … … 1806 1807 tr_variantDictAddInt (d, TR_KEY_date, tr_time ()); 1807 1808 1808 tr_ torinf(tor, "%s", _("Removing torrent"));1809 tr_logAddTorInfo (tor, "%s", _("Removing torrent")); 1809 1810 1810 1811 stopTorrent (tor); … … 1993 1994 NULL }; 1994 1995 1995 tr_ torinf(tor, "Calling script \"%s\"", script);1996 tr_logAddTorInfo (tor, "Calling script \"%s\"", script); 1996 1997 1997 1998 #ifdef WIN32 1998 1999 if (_spawnvpe (_P_NOWAIT, script, (const char*)cmd, env) == -1) 1999 tr_ torerr (tor, "error executing script \"%s\": %s", cmd[0], tr_strerror (errno));2000 tr_logAddTorErr (tor, "error executing script \"%s\": %s", cmd[0], tr_strerror (errno)); 2000 2001 #else 2001 2002 signal (SIGCHLD, onSigCHLD); … … 2007 2008 2008 2009 if (execvp (script, cmd) == -1) 2009 tr_ torerr (tor, "error executing script \"%s\": %s", cmd[0], tr_strerror (errno));2010 tr_logAddTorErr (tor, "error executing script \"%s\": %s", cmd[0], tr_strerror (errno)); 2010 2011 2011 2012 _exit (0); … … 2033 2034 2034 2035 if (recentChange) 2035 tr_ torinf(tor, _("State changed from \"%1$s\" to \"%2$s\""),2036 tr_logAddTorInfo (tor, _("State changed from \"%1$s\" to \"%2$s\""), 2036 2037 getCompletionString (tor->completeness), 2037 2038 getCompletionString (completeness)); … … 2357 2358 err = 5; 2358 2359 2359 if (err) tr_ tordbg (tor, "index %lu offset %lu length %lu err %d\n",2360 if (err) tr_logAddTorDbg (tor, "index %lu offset %lu length %lu err %d\n", 2360 2361 (unsigned long)index, 2361 2362 (unsigned long)offset, … … 2892 2893 assert (tr_isTorrent (tor)); 2893 2894 2894 tr_ dbg ("Moving \"%s\" location from currentDir \"%s\" to \"%s\"",2895 tr_logAddDebug ("Moving \"%s\" location from currentDir \"%s\" to \"%s\"", 2895 2896 tr_torrentName (tor), tor->currentDir, location); 2896 2897 … … 2917 2918 char * newpath = tr_buildPath (location, sub, NULL); 2918 2919 2919 tr_ dbg ("Found file #%d: %s", (int)i, oldpath);2920 tr_logAddDebug ("Found file #%d: %s", (int)i, oldpath); 2920 2921 2921 2922 if (do_move && !tr_is_same_file (oldpath, newpath)) … … 2923 2924 bool renamed = false; 2924 2925 errno = 0; 2925 tr_ torinf(tor, "moving \"%s\" to \"%s\"", oldpath, newpath);2926 tr_logAddTorInfo (tor, "moving \"%s\" to \"%s\"", oldpath, newpath); 2926 2927 if (tr_moveFile (oldpath, newpath, &renamed)) 2927 2928 { 2928 2929 err = true; 2929 tr_ torerr (tor, "error moving \"%s\" to \"%s\": %s",2930 tr_logAddTorErr (tor, "error moving \"%s\" to \"%s\": %s", 2930 2931 oldpath, newpath, tr_strerror (errno)); 2931 2932 } … … 3030 3031 3031 3032 if (rename (oldpath, newpath)) 3032 tr_ torerr (tor, "Error moving \"%s\" to \"%s\": %s", oldpath, newpath, tr_strerror (errno));3033 tr_logAddTorErr (tor, "Error moving \"%s\" to \"%s\": %s", oldpath, newpath, tr_strerror (errno)); 3033 3034 3034 3035 tr_free (newpath); -
trunk/libtransmission/tr-dht.c
r13683 r13868 52 52 #include "transmission.h" 53 53 #include "crypto.h" 54 #include "log.h" 54 55 #include "net.h" 55 56 #include "peer-mgr.h" /* tr_peerMgrCompactToPex () */ … … 123 124 rc = getaddrinfo (name, pp, &hints, &info); 124 125 if (rc != 0) { 125 tr_ nerr ("DHT", "%s:%s: %s", name, pp, gai_strerror (rc));126 tr_logAddNamedError ("DHT", "%s:%s: %s", name, pp, gai_strerror (rc)); 126 127 return; 127 128 } … … 151 152 152 153 if (cl->len > 0) 153 tr_ ninf("DHT", "Bootstrapping from %d IPv4 nodes", num);154 tr_logAddNamedInfo ("DHT", "Bootstrapping from %d IPv4 nodes", num); 154 155 155 156 if (cl->len6 > 0) 156 tr_ ninf("DHT", "Bootstrapping from %d IPv6 nodes", num6);157 tr_logAddNamedInfo ("DHT", "Bootstrapping from %d IPv6 nodes", num6); 157 158 158 159 … … 203 204 f = fopen (bootstrap_file, "rb"); 204 205 if (f != NULL) { 205 tr_ ninf("DHT", "Attempting manual bootstrap");206 tr_logAddNamedInfo ("DHT", "Attempting manual bootstrap"); 206 207 for (;;) { 207 208 char buf[201]; … … 217 218 port = atoi (p + 1); 218 219 if (p == NULL || port <= 0 || port >= 0x10000) { 219 tr_ nerr ("DHT", "Couldn't parse %s", buf);220 tr_logAddNamedError ("DHT", "Couldn't parse %s", buf); 220 221 continue; 221 222 } … … 244 245 break; 245 246 if (i == 0) 246 tr_ ninf("DHT",247 tr_logAddNamedInfo ("DHT", 247 248 "Attempting bootstrap from dht.transmissionbt.com"); 248 249 bootstrap_from_name ("dht.transmissionbt.com", 6881, … … 256 257 tr_free (cl->nodes6); 257 258 tr_free (closure); 258 tr_ ndbg ("DHT", "Finished bootstrapping");259 tr_logAddNamedDbg ("DHT", "Finished bootstrapping"); 259 260 } 260 261 … … 274 275 return -1; 275 276 276 tr_ ndbg ("DHT", "Initializing DHT");277 tr_logAddNamedDbg ("DHT", "Initializing DHT"); 277 278 278 279 if (getenv ("TR_DHT_VERBOSE") != NULL) … … 303 304 304 305 if (have_id) 305 tr_ ninf("DHT", "Reusing old id");306 tr_logAddNamedInfo ("DHT", "Reusing old id"); 306 307 else { 307 308 /* Note that DHT ids need to be distributed uniformly, 308 309 * so it should be something truly random. */ 309 tr_ ninf("DHT", "Generating new id");310 tr_logAddNamedInfo ("DHT", "Generating new id"); 310 311 tr_cryptoRandBuf (myid, 20); 311 312 } … … 328 329 tr_timerAdd (dht_timer, 0, tr_cryptoWeakRandInt (1000000)); 329 330 330 tr_ ndbg ("DHT", "DHT initialized");331 tr_logAddNamedDbg ("DHT", "DHT initialized"); 331 332 332 333 return 1; 333 334 334 335 fail: 335 tr_ ndbg ("DHT", "DHT initialization failed (errno = %d)", errno);336 tr_logAddNamedDbg ("DHT", "DHT initialization failed (errno = %d)", errno); 336 337 session = NULL; 337 338 return -1; … … 344 345 return; 345 346 346 tr_ ndbg ("DHT", "Uninitializing DHT");347 tr_logAddNamedDbg ("DHT", "Uninitializing DHT"); 347 348 348 349 if (dht_timer != NULL) { … … 355 356 if ((tr_dhtStatus (ss, AF_INET, NULL) < TR_DHT_FIREWALLED) && 356 357 (tr_dhtStatus (ss, AF_INET6, NULL) < TR_DHT_FIREWALLED)) { 357 tr_ ninf("DHT", "Not saving nodes, DHT not ready");358 tr_logAddNamedInfo ("DHT", "Not saving nodes, DHT not ready"); 358 359 } else { 359 360 tr_variant benc; … … 365 366 int n = dht_get_nodes (sins, &num, sins6, &num6); 366 367 367 tr_ ninf("DHT", "Saving %d (%d + %d) nodes", n, num, num6);368 tr_logAddNamedInfo ("DHT", "Saving %d (%d + %d) nodes", n, num, num6); 368 369 369 370 j = 0; … … 392 393 393 394 dht_uninit (); 394 tr_ ndbg ("DHT", "Done uninitializing DHT");395 tr_logAddNamedDbg ("DHT", "Done uninitializing DHT"); 395 396 396 397 session = NULL; … … 531 532 tr_peerMgrAddPex (tor, TR_PEER_FROM_DHT, pex+i, -1); 532 533 tr_free (pex); 533 tr_ tordbg (tor, "Learned %d %s peers from DHT",534 tr_logAddTorDbg (tor, "Learned %d %s peers from DHT", 534 535 (int)n, 535 536 event == DHT_EVENT_VALUES6 ? "IPv6" : "IPv4"); … … 541 542 if (tor) { 542 543 if (event == DHT_EVENT_SEARCH_DONE) { 543 tr_ torinf(tor, "%s", "IPv4 DHT announce done");544 tr_logAddTorInfo (tor, "%s", "IPv4 DHT announce done"); 544 545 tor->dhtAnnounceInProgress = 0; 545 546 } else { 546 tr_ torinf(tor, "%s", "IPv6 DHT announce done");547 tr_logAddTorInfo (tor, "%s", "IPv6 DHT announce done"); 547 548 tor->dhtAnnounce6InProgress = 0; 548 549 } … … 571 572 af, callback, NULL); 572 573 if (rc >= 1) { 573 tr_ torinf(tor, "Starting %s DHT announce (%s, %d nodes)",574 tr_logAddTorInfo (tor, "Starting %s DHT announce (%s, %d nodes)", 574 575 af == AF_INET6 ? "IPv6" : "IPv4", 575 576 tr_dhtPrintableStatus (status), numnodes); … … 580 581 ret = 1; 581 582 } else { 582 tr_ torerr (tor, "%s DHT announce failed (%s, %d nodes): %s",583 tr_logAddTorErr (tor, "%s DHT announce failed (%s, %d nodes): %s", 583 584 af == AF_INET6 ? "IPv6" : "IPv4", 584 585 tr_dhtPrintableStatus (status), numnodes, … … 586 587 } 587 588 } else { 588 tr_ tordbg (tor, "%s DHT not ready (%s, %d nodes)",589 tr_logAddTorDbg (tor, "%s DHT not ready (%s, %d nodes)", 589 590 af == AF_INET6 ? "IPv6" : "IPv4", 590 591 tr_dhtPrintableStatus (status), numnodes); … … 644 645 tosleep = 0; 645 646 } else { 646 tr_ nerr ("DHT", "dht_periodic failed: %s", tr_strerror (errno));647 tr_logAddNamedError ("DHT", "dht_periodic failed: %s", tr_strerror (errno)); 647 648 if (errno == EINVAL || errno == EFAULT) 648 649 abort (); -
trunk/libtransmission/tr-lpd.c
r13847 r13868 49 49 /* libT */ 50 50 #include "transmission.h" 51 #include "log.h" 51 52 #include "net.h" 52 53 #include "peer-mgr.h" /* tr_peerMgrAddPex () */ … … 281 282 return -1; 282 283 283 tr_ ndbg ("LPD", "Initialising Local Peer Discovery");284 tr_logAddNamedDbg ("LPD", "Initialising Local Peer Discovery"); 284 285 285 286 /* setup datagram socket (receive) */ … … 352 353 tr_timerAdd (upkeep_timer, UPKEEP_INTERVAL_SECS, 0); 353 354 354 tr_ ndbg ("LPD", "Local Peer Discovery initialised");355 tr_logAddNamedDbg ("LPD", "Local Peer Discovery initialised"); 355 356 356 357 return 1; … … 363 364 lpd_socket = lpd_socket2 = -1; 364 365 session = NULL; 365 tr_ ndbg ("LPD", "LPD initialisation failed (errno = %d)", save);366 tr_logAddNamedDbg ("LPD", "LPD initialisation failed (errno = %d)", save); 366 367 errno = save; 367 368 } … … 376 377 return; 377 378 378 tr_ ndbg ("LPD", "Uninitialising Local Peer Discovery");379 tr_logAddNamedDbg ("LPD", "Uninitialising Local Peer Discovery"); 379 380 380 381 event_free (lpd_event); … … 387 388 evutil_closesocket (lpd_socket); 388 389 evutil_closesocket (lpd_socket2); 389 tr_ ndbg ("LPD", "Done uninitialising Local Peer Discovery");390 tr_logAddNamedDbg ("LPD", "Done uninitialising Local Peer Discovery"); 390 391 391 392 session = NULL; … … 471 472 } 472 473 473 tr_ tordbg (t, "LPD announce message away");474 tr_logAddTorDbg (t, "LPD announce message away"); 474 475 475 476 return true; … … 532 533 /* we found a suitable peer, add it to the torrent */ 533 534 tr_peerMgrAddPex (tor, TR_PEER_FROM_LPD, peer, -1); 534 tr_ tordbg (tor, "Learned %d local peer from LPD (%s:%u)",535 tr_logAddTorDbg (tor, "Learned %d local peer from LPD (%s:%u)", 535 536 1, tr_address_to_string (&peer->addr), peerPort); 536 537 … … 540 541 } 541 542 else 542 tr_ ndbg ("LPD", "Cannot serve torrent #%s", hashString);543 tr_logAddNamedDbg ("LPD", "Cannot serve torrent #%s", hashString); 543 544 } 544 545 … … 609 610 610 611 if (lpd_unsolicitedMsgCounter < 0) 611 tr_ ninf("LPD", "Dropped %d announces in the last interval (max. %d "612 tr_logAddNamedInfo ("LPD", "Dropped %d announces in the last interval (max. %d " 612 613 "allowed)", -lpd_unsolicitedMsgCounter, maxAnnounceCap); 613 614 … … 667 668 } 668 669 669 tr_ ndbg ("LPD", "Discarded invalid multicast message");670 } 671 } 672 670 tr_logAddNamedDbg ("LPD", "Discarded invalid multicast message"); 671 } 672 } 673 -
trunk/libtransmission/tr-udp.c
r13625 r13868 33 33 34 34 #include "transmission.h" 35 #include "log.h" 35 36 #include "net.h" 36 37 #include "session.h" … … 55 56 rc = setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size)); 56 57 if (rc < 0) 57 tr_ nerr ("UDP", "Failed to set receive buffer: %s",58 tr_logAddNamedError ("UDP", "Failed to set receive buffer: %s", 58 59 tr_strerror (errno)); 59 60 … … 61 62 rc = setsockopt (fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size)); 62 63 if (rc < 0) 63 tr_ nerr ("UDP", "Failed to set send buffer: %s",64 tr_logAddNamedError ("UDP", "Failed to set send buffer: %s", 64 65 tr_strerror (errno)); 65 66 … … 74 75 75 76 if (rbuf < RECV_BUFFER_SIZE) { 76 tr_ nerr ("UDP", "Failed to set receive buffer: requested %d, got %d",77 tr_logAddNamedError ("UDP", "Failed to set receive buffer: requested %d, got %d", 77 78 RECV_BUFFER_SIZE, rbuf); 78 79 #ifdef __linux__ 79 tr_ ninf("UDP",80 tr_logAddNamedInfo ("UDP", 80 81 "Please add the line " 81 82 "\"net.core.rmem_max = %d\" to /etc/sysctl.conf", … … 85 86 86 87 if (sbuf < SEND_BUFFER_SIZE) { 87 tr_ nerr ("UDP", "Failed to set send buffer: requested %d, got %d",88 tr_logAddNamedError ("UDP", "Failed to set send buffer: requested %d, got %d", 88 89 SEND_BUFFER_SIZE, sbuf); 89 90 #ifdef __linux__ 90 tr_ ninf("UDP",91 tr_logAddNamedInfo ("UDP", 91 92 "Please add the line " 92 93 "\"net.core.wmem_max = %d\" to /etc/sysctl.conf", … … 178 179 /* Something went wrong. It's difficult to recover, so let's simply 179 180 set things up so that we try again next time. */ 180 tr_ nerr ("UDP", "Couldn't rebind IPv6 socket");181 tr_logAddNamedError ("UDP", "Couldn't rebind IPv6 socket"); 181 182 if (s >= 0) 182 183 close (s); … … 220 221 rc = tau_handle_message (ss, buf, rc); 221 222 if (!rc) 222 tr_ ndbg ("UDP", "Couldn't parse UDP tracker packet.");223 tr_logAddNamedDbg ("UDP", "Couldn't parse UDP tracker packet."); 223 224 } else { 224 225 if (tr_sessionIsUTPEnabled (ss)) { 225 226 rc = tr_utpPacket (buf, rc, (struct sockaddr*)&from, fromlen, ss); 226 227 if (!rc) 227 tr_ ndbg ("UDP", "Unexpected UDP packet");228 tr_logAddNamedDbg ("UDP", "Unexpected UDP packet"); 228 229 } 229 230 } … … 248 249 ss->udp_socket = socket (PF_INET, SOCK_DGRAM, 0); 249 250 if (ss->udp_socket < 0) { 250 tr_ nerr ("UDP", "Couldn't create IPv4 socket");251 tr_logAddNamedError ("UDP", "Couldn't create IPv4 socket"); 251 252 goto ipv6; 252 253 } … … 260 261 rc = bind (ss->udp_socket, (struct sockaddr*)&sin, sizeof (sin)); 261 262 if (rc < 0) { 262 tr_ nerr ("UDP", "Couldn't bind IPv4 socket");263 tr_logAddNamedError ("UDP", "Couldn't bind IPv4 socket"); 263 264 close (ss->udp_socket); 264 265 ss->udp_socket = -1; … … 269 270 event_callback, ss); 270 271 if (ss->udp_event == NULL) 271 tr_ nerr ("UDP", "Couldn't allocate IPv4 event");272 tr_logAddNamedError ("UDP", "Couldn't allocate IPv4 event"); 272 273 273 274 ipv6: … … 279 280 event_callback, ss); 280 281 if (ss->udp6_event == NULL) 281 tr_ nerr ("UDP", "Couldn't allocate IPv6 event");282 tr_logAddNamedError ("UDP", "Couldn't allocate IPv6 event"); 282 283 } 283 284 -
trunk/libtransmission/tr-utp.c
r13625 r13868 29 29 30 30 #include "transmission.h" 31 #include "log.h" 31 32 #include "net.h" 32 33 #include "session.h" … … 40 41 #define dbgmsg(...) \ 41 42 do { \ 42 if (tr_ deepLoggingIsActive()) \43 tr_ deepLog(__FILE__, __LINE__, MY_NAME, __VA_ARGS__); \43 if (tr_logGetDeepEnabled ()) \ 44 tr_logAddDeep (__FILE__, __LINE__, MY_NAME, __VA_ARGS__); \ 44 45 } while (0) 45 46 … … 49 50 UTP_Close (struct UTPSocket * socket) 50 51 { 51 tr_ nerr (MY_NAME, "UTP_Close (%p) was called.", socket);52 tr_logAddNamedError (MY_NAME, "UTP_Close (%p) was called.", socket); 52 53 dbgmsg ("UTP_Close (%p) was called.", socket); 53 54 assert (0); /* FIXME: this is too much for the long term, but probably needed in the short term */ … … 57 58 UTP_RBDrained (struct UTPSocket *socket) 58 59 { 59 tr_ nerr (MY_NAME, "UTP_RBDrained (%p) was called.", socket);60 tr_logAddNamedError (MY_NAME, "UTP_RBDrained (%p) was called.", socket); 60 61 dbgmsg ("UTP_RBDrained (%p) was called.", socket); 61 62 assert (0); /* FIXME: this is too much for the long term, but probably needed in the short term */ … … 65 66 UTP_Write (struct UTPSocket *socket, size_t count) 66 67 { 67 tr_ nerr (MY_NAME, "UTP_RBDrained (%p, %zu) was called.", socket, count);68 tr_logAddNamedError (MY_NAME, "UTP_RBDrained (%p, %zu) was called.", socket, count); 68 69 dbgmsg ("UTP_RBDrained (%p, %zu) was called.", socket, count); 69 70 assert (0); /* FIXME: this is too much for the long term, but probably needed in the short term */ … … 116 117 if (!tr_address_from_sockaddr_storage (&addr, &port, &from_storage)) 117 118 { 118 tr_ nerr ("UTP", "Unknown socket family");119 tr_logAddNamedError ("UTP", "Unknown socket family"); 119 120 UTP_Close (s); 120 121 return; -
trunk/libtransmission/transmission.h
r13845 r13868 802 802 typedef enum 803 803 { 804 TR_MSG_ERR = 1, 805 TR_MSG_INF = 2, 806 TR_MSG_DBG = 3 807 } 808 tr_msg_level; 809 810 void tr_setMessageLevel (tr_msg_level); 811 812 typedef struct tr_msg_list 813 { 814 /* TR_MSG_ERR, TR_MSG_INF, or TR_MSG_DBG */ 815 tr_msg_level level; 816 817 /* The line number in the source file where this message originated */ 818 int line; 819 820 /* Time the message was generated */ 821 time_t when; 822 823 /* The torrent associated with this message, 824 * or a module name such as "Port Forwarding" for non-torrent messages, 825 * or NULL. */ 826 char * name; 827 828 /* The message */ 829 char * message; 830 831 /* The source file where this message originated */ 832 const char * file; 833 834 /* linked list of messages */ 835 struct tr_msg_list * next; 836 } 837 tr_msg_list; 838 839 void tr_setMessageQueuing (bool isEnabled); 840 841 bool tr_getMessageQueuing (void); 842 843 tr_msg_list * tr_getQueuedMessages (void); 844 845 void tr_freeMessageList (tr_msg_list * freeme); 804 TR_LOG_ERROR = 1, 805 TR_LOG_INFO = 2, 806 TR_LOG_DEBUG = 3, 807 TR_LOG_FIREHOSE = 4 808 } 809 tr_log_level; 810 811 void tr_logSetLevel (tr_log_level); 812 813 typedef struct tr_log_message 814 { 815 /* TR_LOG_ERROR, TR_LOG_INFO, or TR_LOG_DEBUG */ 816 tr_log_level level; 817 818 /* The line number in the source file where this message originated */ 819 int line; 820 821 /* Time the message was generated */ 822 time_t when; 823 824 /* The torrent associated with this message, 825 * or a module name such as "Port Forwarding" for non-torrent messages, 826 * or NULL. */ 827 char * name; 828 829 /* The message */ 830 char * message; 831 832 /* The source file where this message originated */ 833 const char * file; 834 835 /* linked list of messages */ 836 struct tr_log_message * next; 837 } 838 tr_log_message; 839 840 tr_log_message * tr_logGetQueue (void); 841 bool tr_logGetQueueEnabled (void); 842 void tr_logSetQueueEnabled (bool isEnabled); 843 void tr_logFreeQueue (tr_log_message * freeme); 846 844 847 845 /** @addtogroup Blocklists -
trunk/libtransmission/trevent.c
r13625 r13868 21 21 22 22 #include "transmission.h" 23 #include "log.h" 23 24 #include "net.h" 24 25 #include "session.h" … … 40 41 if ((s = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) 41 42 { 42 tr_ dbg ("pgpipe failed to create socket: %ui", WSAGetLastError ());43 tr_logAddDebug ("pgpipe failed to create socket: %ui", WSAGetLastError ()); 43 44 return -1; 44 45 } … … 50 51 if (bind (s, (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR) 51 52 { 52 tr_ dbg ("pgpipe failed to bind: %ui", WSAGetLastError ());53 tr_logAddDebug ("pgpipe failed to bind: %ui", WSAGetLastError ()); 53 54 closesocket (s); 54 55 return -1; … … 56 57 if (listen (s, 1) == SOCKET_ERROR) 57 58 { 58 tr_ ndbg ("event","pgpipe failed to listen: %ui", WSAGetLastError ());59 tr_logAddNamedDbg ("event","pgpipe failed to listen: %ui", WSAGetLastError ()); 59 60 closesocket (s); 60 61 return -1; … … 62 63 if (getsockname (s, (SOCKADDR *) & serv_addr, &len) == SOCKET_ERROR) 63 64 { 64 tr_ dbg ("pgpipe failed to getsockname: %ui", WSAGetLastError ());65 tr_logAddDebug ("pgpipe failed to getsockname: %ui", WSAGetLastError ()); 65 66 closesocket (s); 66 67 return -1; … … 68 69 if ((handles[1] = socket (PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) 69 70 { 70 tr_ dbg ("pgpipe failed to create socket 2: %ui", WSAGetLastError ());71 tr_logAddDebug ("pgpipe failed to create socket 2: %ui", WSAGetLastError ()); 71 72 closesocket (s); 72 73 return -1; … … 75 76 if (connect (handles[1], (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR) 76 77 { 77 tr_ dbg ("pgpipe failed to connect socket: %ui", WSAGetLastError ());78 tr_logAddDebug ("pgpipe failed to connect socket: %ui", WSAGetLastError ()); 78 79 closesocket (s); 79 80 return -1; … … 81 82 if ((handles[0] = accept (s, (SOCKADDR *) & serv_addr, &len)) == INVALID_SOCKET) 82 83 { 83 tr_ dbg ("pgpipe failed to accept socket: %ui", WSAGetLastError ());84 tr_logAddDebug ("pgpipe failed to accept socket: %ui", WSAGetLastError ()); 84 85 closesocket (handles[1]); 85 86 handles[1] = INVALID_SOCKET; … … 155 156 #define dbgmsg(...) \ 156 157 do { \ 157 if (tr_ deepLoggingIsActive()) \158 tr_ deepLog(__FILE__, __LINE__, "event", __VA_ARGS__); \158 if (tr_logGetDeepEnabled ()) \ 159 tr_logAddDeep (__FILE__, __LINE__, "event", __VA_ARGS__); \ 159 160 } while (0) 160 161 … … 214 215 { 215 216 if (severity >= _EVENT_LOG_ERR) 216 tr_ err ("%s", message);217 tr_logAddError ("%s", message); 217 218 else 218 tr_ dbg ("%s", message);219 tr_logAddDebug ("%s", message); 219 220 } 220 221 … … 253 254 eh->session->events = NULL; 254 255 tr_free (eh); 255 tr_ dbg ("Closing libevent thread");256 tr_logAddDebug ("Closing libevent thread"); 256 257 } 257 258 … … 280 281 281 282 session->events->die = true; 282 tr_ deepLog(__FILE__, __LINE__, NULL, "closing trevent pipe");283 tr_logAddDeep (__FILE__, __LINE__, NULL, "closing trevent pipe"); 283 284 tr_netCloseSocket (session->events->fds[1]); 284 285 } -
trunk/libtransmission/upnp.c
r13631 r13868 27 27 28 28 #include "transmission.h" 29 #include "log.h" 29 30 #include "port-forwarding.h" 30 31 #include "session.h" … … 102 103 103 104 if (ret != UPNPCOMMAND_SUCCESS) 104 tr_ ndbg (getKey (), "upnpDiscover failed (errno %d - %s)", err, tr_strerror (err));105 tr_logAddNamedDbg (getKey (), "upnpDiscover failed (errno %d - %s)", err, tr_strerror (err)); 105 106 106 107 return ret; … … 150 151 151 152 if (err) 152 tr_ ndbg (getKey (), "%s Port forwarding failed with error %d (errno %d - %s)", proto, err, errno, tr_strerror (errno));153 tr_logAddNamedDbg (getKey (), "%s Port forwarding failed with error %d (errno %d - %s)", proto, err, errno, tr_strerror (errno)); 153 154 154 155 errno = old_errno; … … 198 199 handle->lanaddr, sizeof (handle->lanaddr)) == UPNP_IGD_VALID_CONNECTED) 199 200 { 200 tr_ ninf(getKey (), _(201 tr_logAddNamedInfo (getKey (), _( 201 202 "Found Internet Gateway Device \"%s\""), 202 203 handle->urls.controlURL); 203 tr_ ninf(getKey (), _(204 tr_logAddNamedInfo (getKey (), _( 204 205 "Local Address is \"%s\""), handle->lanaddr); 205 206 handle->state = TR_UPNP_IDLE; … … 209 210 { 210 211 handle->state = TR_UPNP_ERR; 211 tr_ ndbg (212 tr_logAddNamedDbg ( 212 213 getKey (), "UPNP_GetValidIGD failed (errno %d - %s)", 213 214 errno, 214 215 tr_strerror (errno)); 215 tr_ ndbg (216 tr_logAddNamedDbg ( 216 217 getKey (), 217 218 "If your router supports UPnP, please make sure UPnP is enabled!"); … … 231 232 (tr_upnpGetSpecificPortMappingEntry (handle, "UDP") != UPNPCOMMAND_SUCCESS)) 232 233 { 233 tr_ ninf(getKey (), _("Port %d isn't forwarded"), handle->port);234 tr_logAddNamedInfo (getKey (), _("Port %d isn't forwarded"), handle->port); 234 235 handle->isMapped = false; 235 236 } … … 241 242 tr_upnpDeletePortMapping (handle, "UDP", handle->port); 242 243 243 tr_ ninf(getKey (),244 tr_logAddNamedInfo (getKey (), 244 245 _("Stopping port forwarding through \"%s\", service \"%s\""), 245 246 handle->urls.controlURL, handle->data.first.servicetype); … … 274 275 handle->isMapped = !err_tcp | !err_udp; 275 276 } 276 tr_ ninf(getKey (),277 tr_logAddNamedInfo (getKey (), 277 278 _("Port forwarding through \"%s\", service \"%s\". (local address: %s:%d)"), 278 279 handle->urls.controlURL, handle->data.first.servicetype, … … 280 281 if (handle->isMapped) 281 282 { 282 tr_ ninf(getKey (), "%s", _("Port forwarding successful!"));283 tr_logAddNamedInfo (getKey (), "%s", _("Port forwarding successful!")); 283 284 handle->port = port; 284 285 handle->state = TR_UPNP_IDLE; … … 286 287 else 287 288 { 288 tr_ ndbg (getKey (), "If your router supports UPnP, please make sure UPnP is enabled!");289 tr_logAddNamedDbg (getKey (), "If your router supports UPnP, please make sure UPnP is enabled!"); 289 290 handle->port = -1; 290 291 handle->state = TR_UPNP_ERR; -
trunk/libtransmission/utils.c
r13863 r13868 57 57 #include "ConvertUTF.h" 58 58 #include "list.h" 59 #include "log.h" 59 60 #include "utils.h" 60 61 #include "platform.h" /* tr_lockLock (), TR_PATH_MAX */ … … 63 64 64 65 65 time_t __tr_current_time = 0; 66 tr_msg_level __tr_message_level = TR_MSG_ERR; 67 68 static bool messageQueuing = false; 69 static tr_msg_list * messageQueue = NULL; 70 static tr_msg_list ** messageQueueTail = &messageQueue; 71 static int messageQueueCount = 0; 72 73 #ifndef WIN32 74 /* make null versions of these win32 functions */ 75 static inline int IsDebuggerPresent (void) { return false; } 76 static inline void OutputDebugString (const void * unused UNUSED) { } 77 #endif 66 time_t __tr_current_time = 0; 78 67 79 68 /*** 80 69 **** 81 70 ***/ 82 83 static tr_lock*84 getMessageLock (void)85 {86 static tr_lock * l = NULL;87 88 if (!l)89 l = tr_lockNew ();90 91 return l;92 }93 94 void*95 tr_getLog (void)96 {97 static bool initialized = false;98 static FILE * file = NULL;99 100 if (!initialized)101 {102 int fd = 0;103 const char * str = getenv ("TR_DEBUG_FD");104 105 if (str && *str)106 fd = atoi (str);107 108 switch (fd)109 {110 case 1:111 file = stdout;112 break;113 114 case 2:115 file = stderr;116 break;117 118 default:119 file = NULL;120 break;121 }122 123 initialized = true;124 }125 126 return file;127 }128 129 void130 tr_setMessageLevel (tr_msg_level level)131 {132 __tr_message_level = level;133 }134 135 void136 tr_setMessageQueuing (bool enabled)137 {138 messageQueuing = enabled;139 }140 141 bool142 tr_getMessageQueuing (void)143 {144 return messageQueuing != 0;145 }146 147 tr_msg_list *148 tr_getQueuedMessages (void)149 {150 tr_msg_list * ret;151 tr_lockLock (getMessageLock ());152 153 ret = messageQueue;154 messageQueue = NULL;155 messageQueueTail = &messageQueue;156 157 messageQueueCount = 0;158 159 tr_lockUnlock (getMessageLock ());160 return ret;161 }162 163 void164 tr_freeMessageList (tr_msg_list * list)165 {166 tr_msg_list * next;167 168 while (NULL != list)169 {170 next = list->next;171 free (list->message);172 free (list->name);173 free (list);174 list = next;175 }176 }177 178 /**179 ***180 **/181 71 182 72 struct tm * … … 191 81 return p; 192 82 #endif 193 }194 195 char*196 tr_getLogTimeStr (char * buf, int buflen)197 {198 char tmp[64];199 struct tm now_tm;200 struct timeval tv;201 time_t seconds;202 int milliseconds;203 204 gettimeofday (&tv, NULL);205 206 seconds = tv.tv_sec;207 tr_localtime_r (&seconds, &now_tm);208 strftime (tmp, sizeof (tmp), "%H:%M:%S", &now_tm);209 milliseconds = tv.tv_usec / 1000;210 tr_snprintf (buf, buflen, "%s.%03d", tmp, milliseconds);211 212 return buf;213 }214 215 bool216 tr_deepLoggingIsActive (void)217 {218 static int8_t deepLoggingIsActive = -1;219 220 if (deepLoggingIsActive < 0)221 deepLoggingIsActive = IsDebuggerPresent () || (tr_getLog ()!=NULL);222 223 return deepLoggingIsActive != 0;224 }225 226 void227 tr_deepLog (const char * file,228 int line,229 const char * name,230 const char * fmt,231 ...)232 {233 FILE * fp = tr_getLog ();234 if (fp || IsDebuggerPresent ())235 {236 va_list args;237 char timestr[64];238 char * message;239 struct evbuffer * buf = evbuffer_new ();240 char * base = tr_basename (file);241 242 evbuffer_add_printf (buf, "[%s] ",243 tr_getLogTimeStr (timestr, sizeof (timestr)));244 if (name)245 evbuffer_add_printf (buf, "%s ", name);246 va_start (args, fmt);247 evbuffer_add_vprintf (buf, fmt, args);248 va_end (args);249 evbuffer_add_printf (buf, " (%s:%d)\n", base, line);250 /* FIXME (libevent2) ifdef this out for nonwindows platforms */251 message = evbuffer_free_to_str (buf);252 OutputDebugString (message);253 if (fp)254 fputs (message, fp);255 256 tr_free (message);257 tr_free (base);258 }259 }260 261 /***262 ****263 ***/264 265 void266 tr_msg (const char * file, int line,267 tr_msg_level level,268 const char * name,269 const char * fmt, ...)270 {271 const int err = errno; /* message logging shouldn't affect errno */272 char buf[1024];273 va_list ap;274 tr_lockLock (getMessageLock ());275 276 /* build the text message */277 *buf = '\0';278 va_start (ap, fmt);279 evutil_vsnprintf (buf, sizeof (buf), fmt, ap);280 va_end (ap);281 282 OutputDebugString (buf);283 284 if (*buf)285 {286 if (messageQueuing)287 {288 tr_msg_list * newmsg;289 newmsg = tr_new0 (tr_msg_list, 1);290 newmsg->level = level;291 newmsg->when = tr_time ();292 newmsg->message = tr_strdup (buf);293 newmsg->file = file;294 newmsg->line = line;295 newmsg->name = tr_strdup (name);296 297 *messageQueueTail = newmsg;298 messageQueueTail = &newmsg->next;299 ++messageQueueCount;300 301 if (messageQueueCount > TR_MAX_MSG_LOG)302 {303 tr_msg_list * old = messageQueue;304 messageQueue = old->next;305 old->next = NULL;306 tr_freeMessageList (old);307 --messageQueueCount;308 assert (messageQueueCount == TR_MAX_MSG_LOG);309 }310 }311 else312 {313 FILE * fp;314 char timestr[64];315 316 fp = tr_getLog ();317 if (fp == NULL)318 fp = stderr;319 320 tr_getLogTimeStr (timestr, sizeof (timestr));321 322 if (name)323 fprintf (fp, "[%s] %s: %s\n", timestr, name, buf);324 else325 fprintf (fp, "[%s] %s\n", timestr, buf);326 fflush (fp);327 }328 }329 330 tr_lockUnlock (getMessageLock ());331 errno = err;332 83 } 333 84 … … 447 198 { 448 199 const int err = errno; 449 tr_ dbg (err_fmt, path, tr_strerror (errno));200 tr_logAddDebug (err_fmt, path, tr_strerror (errno)); 450 201 errno = err; 451 202 return NULL; … … 454 205 if ((sb.st_mode & S_IFMT) != S_IFREG) 455 206 { 456 tr_ err (err_fmt, path, _("Not a regular file"));207 tr_logAddError (err_fmt, path, _("Not a regular file")); 457 208 errno = EISDIR; 458 209 return NULL; … … 464 215 { 465 216 const int err = errno; 466 tr_ err (err_fmt, path, tr_strerror (errno));217 tr_logAddError (err_fmt, path, tr_strerror (errno)); 467 218 errno = err; 468 219 return NULL; … … 472 223 { 473 224 const int err = errno; 474 tr_ err (err_fmt, path, _("Memory allocation failed"));225 tr_logAddError (err_fmt, path, _("Memory allocation failed")); 475 226 tr_close_file (fd); 476 227 errno = err; … … 481 232 { 482 233 const int err = errno; 483 tr_ err (err_fmt, path, tr_strerror (errno));234 tr_logAddError (err_fmt, path, tr_strerror (errno)); 484 235 tr_close_file (fd); 485 236 free (buf); … … 580 331 { 581 332 tmperr = errno; 582 tr_ err (_("Couldn't create \"%1$s\": %2$s"), path, tr_strerror (tmperr));333 tr_logAddError (_("Couldn't create \"%1$s\": %2$s"), path, tr_strerror (tmperr)); 583 334 tr_free (path); 584 335 errno = tmperr; … … 590 341 /* Node exists but isn't a folder */ 591 342 char * buf = tr_strdup_printf (_("File \"%s\" is in the way"), path); 592 tr_ err (_("Couldn't create \"%1$s\": %2$s"), path_in, buf);343 tr_logAddError (_("Couldn't create \"%1$s\": %2$s"), path_in, buf); 593 344 tr_free (buf); 594 345 tr_free (path); -
trunk/libtransmission/utils.h
r13708 r13868 101 101 ***** 102 102 ****/ 103 104 #define TR_MAX_MSG_LOG 10000105 106 extern tr_msg_level __tr_message_level;107 108 static inline tr_msg_level tr_getMessageLevel (void)109 {110 return __tr_message_level;111 }112 113 static inline bool tr_msgLoggingIsActive (tr_msg_level level)114 {115 return tr_getMessageLevel () >= level;116 }117 118 void tr_msg (const char * file, int line,119 tr_msg_level level,120 const char * torrent,121 const char * fmt, ...) TR_GNUC_PRINTF (5, 6);122 123 #define tr_nerr(n, ...) \124 do { \125 if (tr_msgLoggingIsActive (TR_MSG_ERR)) \126 tr_msg (__FILE__, __LINE__, TR_MSG_ERR, n, __VA_ARGS__); \127 } while (0)128 129 #define tr_ninf(n, ...) \130 do { \131 if (tr_msgLoggingIsActive (TR_MSG_INF)) \132 tr_msg (__FILE__, __LINE__, TR_MSG_INF, n, __VA_ARGS__); \133 } while (0)134 135 #define tr_ndbg(n, ...) \136 do { \137 if (tr_msgLoggingIsActive (TR_MSG_DBG)) \138 tr_msg (__FILE__, __LINE__, TR_MSG_DBG, n, __VA_ARGS__); \139 } while (0)140 141 #define tr_torerr(tor, ...) \142 do { \143 if (tr_msgLoggingIsActive (TR_MSG_ERR)) \144 tr_msg (__FILE__, __LINE__, TR_MSG_ERR, tr_torrentName (tor), __VA_ARGS__); \145 } while (0)146 147 #define tr_torinf(tor, ...) \148 do { \149 if (tr_msgLoggingIsActive (TR_MSG_INF)) \150 tr_msg (__FILE__, __LINE__, TR_MSG_INF, tr_torrentName (tor), __VA_ARGS__); \151 } while (0)152 153 #define tr_tordbg(tor, ...) \154 do { \155 if (tr_msgLoggingIsActive (TR_MSG_DBG)) \156 tr_msg (__FILE__, __LINE__, TR_MSG_DBG, tr_torrentName (tor), __VA_ARGS__); \157 } while (0)158 159 #define tr_err(...) \160 do { \161 if (tr_msgLoggingIsActive (TR_MSG_ERR)) \162 tr_msg (__FILE__, __LINE__, TR_MSG_ERR, NULL, __VA_ARGS__); \163 } while (0)164 165 #define tr_inf(...) \166 do { \167 if (tr_msgLoggingIsActive (TR_MSG_INF)) \168 tr_msg (__FILE__, __LINE__, TR_MSG_INF, NULL, __VA_ARGS__); \169 } while (0)170 171 #define tr_dbg(...) \172 do { \173 if (tr_msgLoggingIsActive (TR_MSG_DBG)) \174 tr_msg (__FILE__, __LINE__, TR_MSG_DBG, NULL, __VA_ARGS__); \175 } while (0)176 177 178 179 void* tr_getLog (void);180 181 /** @brief return true if deep logging has been enabled by the user; false otherwise */182 bool tr_deepLoggingIsActive (void);183 184 void tr_deepLog (const char * file,185 int line,186 const char * name,187 const char * fmt,188 ...) TR_GNUC_PRINTF (4, 5) TR_GNUC_NONNULL (1,4);189 190 /** @brief set the buffer with the current time formatted for deep logging. */191 char* tr_getLogTimeStr (char * buf, int buflen) TR_GNUC_NONNULL (1);192 193 103 194 104 /** -
trunk/libtransmission/variant-json.c
r13858 r13868 29 29 #include "ConvertUTF.h" 30 30 #include "list.h" 31 #include "log.h" 31 32 #include "ptrarray.h" 32 33 #include "utils.h" … … 91 92 if (data->source) 92 93 { 93 tr_ err ("JSON parse failed in %s at pos %zu: %s -- remaining text \"%.16s\"",94 tr_logAddError ("JSON parse failed in %s at pos %zu: %s -- remaining text \"%.16s\"", 94 95 data->source, 95 96 jsn->pos, … … 99 100 else 100 101 { 101 tr_ err ("JSON parse failed at pos %zu: %s -- remaining text \"%.16s\"",102 tr_logAddError ("JSON parse failed at pos %zu: %s -- remaining text \"%.16s\"", 102 103 jsn->pos, 103 104 jsonsl_strerror (error), -
trunk/libtransmission/variant.c
r13861 r13868 32 32 #include "ConvertUTF.h" 33 33 #include "fdlimit.h" /* tr_close_file() */ 34 #include "log.h" 34 35 #include "platform.h" /* TR_PATH_MAX */ 35 36 #include "utils.h" /* tr_new(), tr_free() */ … … 889 890 default: 890 891 /* did caller give us an uninitialized val? */ 891 tr_ err ("%s", _("Invalid metadata"));892 tr_logAddError ("%s", _("Invalid metadata")); 892 893 break; 893 894 } … … 979 980 else 980 981 { 981 tr_ err ("tr_variantListCopy skipping item");982 tr_logAddError ("tr_variantListCopy skipping item"); 982 983 } 983 984 } … … 1075 1076 else 1076 1077 { 1077 tr_ dbg ("tr_variantMergeDicts skipping \"%s\"", tr_quark_get_string(key,NULL));1078 tr_logAddDebug ("tr_variantMergeDicts skipping \"%s\"", tr_quark_get_string(key,NULL)); 1078 1079 } 1079 1080 } … … 1191 1192 if (nleft > 0) 1192 1193 { 1193 tr_ err (_("Couldn't save temporary file \"%1$s\": %2$s"), tmp, tr_strerror (err));1194 tr_logAddError (_("Couldn't save temporary file \"%1$s\": %2$s"), tmp, tr_strerror (err)); 1194 1195 tr_close_file (fd); 1195 1196 unlink (tmp); … … 1205 1206 #endif 1206 1207 { 1207 tr_ inf(_("Saved \"%s\""), filename);1208 tr_logAddInfo (_("Saved \"%s\""), filename); 1208 1209 } 1209 1210 else 1210 1211 { 1211 1212 err = errno; 1212 tr_ err (_("Couldn't save file \"%1$s\": %2$s"), filename, tr_strerror (err));1213 tr_logAddError (_("Couldn't save file \"%1$s\": %2$s"), filename, tr_strerror (err)); 1213 1214 unlink (tmp); 1214 1215 } … … 1218 1219 { 1219 1220 err = errno; 1220 tr_ err (_("Couldn't save temporary file \"%1$s\": %2$s"), tmp, tr_strerror (err));1221 tr_logAddError (_("Couldn't save temporary file \"%1$s\": %2$s"), tmp, tr_strerror (err)); 1221 1222 } 1222 1223 -
trunk/libtransmission/verify.c
r13631 r13868 25 25 #include "fdlimit.h" 26 26 #include "list.h" 27 #include "log.h" 27 28 #include "platform.h" /* tr_lock () */ 28 29 #include "torrent.h" … … 59 60 SHA1_Init (&sha); 60 61 61 tr_ tordbg (tor, "%s", "verifying torrent...");62 tr_logAddTorDbg (tor, "%s", "verifying torrent..."); 62 63 tr_torrentSetChecked (tor, 0); 63 64 while (!*stopFlag && (pieceIndex < tor->info.pieceCount)) … … 160 161 /* stopwatch */ 161 162 end = tr_time (); 162 tr_ tordbg (tor, "Verification is done. It took %d seconds to verify %"PRIu64" bytes (%"PRIu64" bytes per second)",163 tr_logAddTorDbg (tor, "Verification is done. It took %d seconds to verify %"PRIu64" bytes (%"PRIu64" bytes per second)", 163 164 (int)(end-begin), tor->info.totalSize, 164 165 (uint64_t)(tor->info.totalSize/ (1+ (end-begin)))); … … 227 228 tr_lockUnlock (getVerifyLock ()); 228 229 229 tr_ torinf(tor, "%s", _("Verifying torrent"));230 tr_logAddTorInfo (tor, "%s", _("Verifying torrent")); 230 231 tr_torrentSetVerifyState (tor, TR_VERIFY_NOW); 231 232 changed = verifyTorrent (tor, &stopCurrent); … … 271 272 272 273 assert (tr_isTorrent (tor)); 273 tr_ torinf(tor, "%s", _("Queued for verification"));274 tr_logAddTorInfo (tor, "%s", _("Queued for verification")); 274 275 275 276 node = tr_new (struct verify_node, 1); -
trunk/libtransmission/web.c
r13863 r13868 25 25 26 26 #include "transmission.h" 27 #include "log.h" 27 28 #include "net.h" /* tr_address */ 28 29 #include "platform.h" /* mutex */ … … 51 52 #define dbgmsg(...) \ 52 53 do { \ 53 if (tr_ deepLoggingIsActive()) \54 tr_ deepLog(__FILE__, __LINE__, "web", __VA_ARGS__); \54 if (tr_logGetDeepEnabled ()) \ 55 tr_logAddDeep (__FILE__, __LINE__, "web", __VA_ARGS__); \ 55 56 } while (0) 56 57 #endif … … 337 338 if (web->curl_ssl_verify) 338 339 { 339 tr_ ninf("web", "will verify tracker certs using envvar CURL_CA_BUNDLE: %s",340 tr_logAddNamedInfo ("web", "will verify tracker certs using envvar CURL_CA_BUNDLE: %s", 340 341 web->curl_ca_bundle == NULL ? "none" : web->curl_ca_bundle); 341 tr_ ninf("web", "NB: this only works if you built against libcurl with openssl or gnutls, NOT nss");342 tr_ ninf("web", "NB: invalid certs will show up as 'Could not connect to tracker' like many other errors");342 tr_logAddNamedInfo ("web", "NB: this only works if you built against libcurl with openssl or gnutls, NOT nss"); 343 tr_logAddNamedInfo ("web", "NB: invalid certs will show up as 'Could not connect to tracker' like many other errors"); 343 344 } 344 345 web->cookie_filename = tr_buildPath (session->configDir, "cookies.txt", NULL); -
trunk/macosx/MessageWindowController.m
r13492 r13868 185 185 - (void) updateLog: (NSTimer *) timer 186 186 { 187 tr_ msg_list* messages;188 if ((messages = tr_ getQueuedMessages()) == NULL)187 tr_log_message * messages; 188 if ((messages = tr_logGetQueue()) == NULL) 189 189 return; 190 190 … … 202 202 BOOL changed = NO; 203 203 204 for (tr_ msg_list* currentMessage = messages; currentMessage != NULL; currentMessage = currentMessage->next)204 for (tr_log_message * currentMessage = messages; currentMessage != NULL; currentMessage = currentMessage->next) 205 205 { 206 206 NSString * name = currentMessage->name != NULL ? [NSString stringWithUTF8String: currentMessage->name] … … 227 227 } 228 228 229 if ([fMessages count] > TR_ MAX_MSG_LOG)229 if ([fMessages count] > TR_LOG_MAX_QUEUE_LENGTH) 230 230 { 231 231 const NSUInteger oldCount = [fDisplayedMessages count]; 232 232 233 NSIndexSet * removeIndexes = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fMessages count]-TR_ MAX_MSG_LOG)];233 NSIndexSet * removeIndexes = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fMessages count]-TR_LOG_MAX_QUEUE_LENGTH)]; 234 234 NSArray * itemsToRemove = [fMessages objectsAtIndexes: removeIndexes]; 235 235 … … 251 251 [fLock unlock]; 252 252 253 tr_ freeMessageList(messages);253 tr_logFreeQueue (messages); 254 254 } 255 255 -
trunk/qt/details.cc
r13810 r13868 844 844 myFileTreeView->clear( ); 845 845 if( single ) 846 myFileTreeView->update( torrents[0]->files( ) , myChangedTorrents ); 846 myFileTreeView->update( torrents[0]->files( ) , myFilesDirty || myChangedTorrents ); 847 847 848 myFilesDirty = false; 848 849 849 myChangedTorrents = false; 850 850 myHavePendingRefresh = false; -
trunk/qt/file-tree.cc
r13867 r13868 184 184 uint64_t totalSize, 185 185 uint64_t haveSize, 186 bool torrentChanged)186 bool updateFields) 187 187 { 188 188 bool changed = false; 189 190 std::cerr << __FILE__ << ':' << __LINE__ << " index " << index << " wanted " << wanted << " myIndex " << myIndex << " myWanted" << myIsWanted << std::endl; 189 191 190 192 if (myIndex != index) … … 194 196 } 195 197 196 if ( torrentChanged&& myIsWanted != wanted)198 if (updateFields && myIsWanted != wanted) 197 199 { 198 200 myIsWanted = wanted; 199 201 changed = true; 200 } 201 202 if (torrentChanged && myPriority != priority) 202 std::cerr << __FILE__ << ':' << __LINE__ << " setting myIsWanted to " << myIsWanted << std::endl; 203 } 204 205 if (updateFields && myPriority != priority) 203 206 { 204 207 myPriority = priority; … … 286 289 else 287 290 p = TR_PRI_LOW; 291 std::cerr << __FILE__ << ':' << __LINE__ << " twiddlePriority, p " << p << std::endl; 288 292 289 293 setSubtreePriority (p, ids); … … 317 321 FileTreeItem :: setSubtreeWanted (bool b, QSet<int>& ids) 318 322 { 319 if(myIsWanted != b) 323 std::cerr << __FILE__ << ':' << __LINE__ << " twiddleWanted, wanted " << b << std::endl; 324 if (myIsWanted != b) 320 325 { 321 326 myIsWanted = b; … … 332 337 FileTreeItem :: twiddleWanted (QSet<int>& ids, bool& wanted) 333 338 { 339 std::cerr << __FILE__ << ':' << __LINE__ << " twiddleWanted" << std::endl; 334 340 wanted = isSubtreeWanted() != Qt::Checked; 335 341 setSubtreeWanted (wanted, ids); … … 349 355 FileTreeModel :: ~FileTreeModel() 350 356 { 357 std::cerr << __FILE__ << ':' << __LINE__ << " dtor " << std::endl; 351 358 clear(); 352 359 … … 517 524 { 518 525 size_t i = rowCount (top); 526 std::cerr << __FILE__ << ':' << __LINE__ << " clearSubtree " << i << std::endl; 519 527 520 528 while (i > 0) 521 529 clearSubtree(index(--i, 0, top)); 522 530 523 531 delete static_cast<FileTreeItem*>(top.internalPointer()); 524 532 } 525 533 … … 527 535 FileTreeModel :: clear () 528 536 { 537 std::cerr << __FILE__ << ':' << __LINE__ << " clear" << std::endl; 529 538 clearSubtree (QModelIndex()); 530 539 … … 540 549 uint64_t have, 541 550 QList<QModelIndex> & rowsAdded, 542 bool torrentChanged) 543 { 551 bool updateFields) 552 { 553 bool added = false; 544 554 FileTreeItem * i (rootItem); 545 555 … … 549 559 if (!child) 550 560 { 561 added = true; 551 562 QModelIndex parentIndex (indexOf(i, 0)); 552 563 const int n (i->childCount()); … … 560 571 561 572 if (i != rootItem) 562 if (i->update (index, wanted, priority, size, have, torrentChanged)) 563 dataChanged (indexOf(i, 0), indexOf(i, NUM_COLUMNS-1)); 573 { 574 if (i->update (index, wanted, priority, size, have, added || updateFields)) 575 { 576 std::cerr << __FILE__ << ':' << __LINE__ << " emitting dataChanged for row " << i << std::endl; 577 dataChanged (indexOf(i, 0), indexOf(i, NUM_COLUMNS-1)); 578 } 579 } 564 580 } 565 581 … … 622 638 FileTreeItem * item; 623 639 640 std::cerr << "clicked in COL_PRIORITY" << std::endl; 624 641 item = static_cast<FileTreeItem*>(index.internalPointer()); 625 642 item->twiddlePriority (file_ids, priority); … … 800 817 FileTreeView :: onClicked (const QModelIndex& proxyIndex) 801 818 { 802 const QModelIndex modelIndex = myProxy->mapToSource(proxyIndex); 803 myModel.clicked(modelIndex); 819 const QModelIndex modelIndex = myProxy->mapToSource (proxyIndex); 820 std::cerr << __FILE__ << ':' << __LINE__ << " calling myModel.clicked()" << std::endl; 821 myModel.clicked (modelIndex); 804 822 } 805 823 … … 836 854 } 837 855 856 #if 0 838 857 // handle using the keyboard to toggle the 839 858 // wanted/unwanted state or the file priority 840 else if(event->type() == QEvent::KeyPress) 841 { 859 else if (event->type() == QEvent::KeyPress) 860 { 861 std::cerr << __FILE__ << ':' << __LINE__ << " " << qPrintable(dynamic_cast<QKeyEvent*>(event)->text()) << std::endl; 842 862 switch(dynamic_cast<QKeyEvent*>(event)->key()) 843 863 { 844 864 case Qt::Key_Space: 865 std::cerr << __FILE__ << ':' << __LINE__ << " calling COL_WANTED.clicked()" << std::endl; 845 866 foreach (QModelIndex i, selectionModel()->selectedRows(COL_WANTED)) 846 867 clicked (i); … … 849 870 case Qt::Key_Enter: 850 871 case Qt::Key_Return: 872 std::cerr << __FILE__ << ':' << __LINE__ << " calling COL_PRIORITY.clicked()" << std::endl; 851 873 foreach (QModelIndex i, selectionModel()->selectedRows(COL_PRIORITY)) 852 874 clicked (i); … … 854 876 } 855 877 } 878 #endif 856 879 857 880 return false; … … 865 888 866 889 void 867 FileTreeView :: update (const FileList& files, bool torrentChanged) 868 { 890 FileTreeView :: update (const FileList& files, bool updateFields) 891 { 892 std::cerr << "update updateFields " << updateFields << std::endl; 869 893 foreach (const TrFile file, files) 870 894 { 871 895 QList<QModelIndex> added; 872 myModel.addFile (file.index, file.filename, file.wanted, file.priority, file.size, file.have, added, torrentChanged); 896 std::cerr << __FILE__ << ':' << __LINE__ << " add file " << qPrintable(file.filename) << " wanted " << file.wanted << std::endl; 897 myModel.addFile (file.index, file.filename, file.wanted, file.priority, file.size, file.have, added, updateFields); 873 898 foreach (QModelIndex i, added) 874 899 expand (myProxy->mapFromSource(i)); … … 879 904 FileTreeView :: clear () 880 905 { 906 std::cerr << __FILE__ << ':' << __LINE__ << " clear" << std::endl; 881 907 myModel.clear(); 882 908 } -
trunk/qt/file-tree.h
r13866 r13868 64 64 const QString& name () const { return myName; } 65 65 QVariant data (int column, int role) const; 66 bool update (int index, bool want, int priority, uint64_t total, uint64_t have, bool torrentChanged);66 bool update (int index, bool want, int priority, uint64_t total, uint64_t have, bool updateFields); 67 67 void twiddleWanted (QSet<int>& fileIds, bool&); 68 68 void twiddlePriority (QSet<int>& fileIds, int&); -
trunk/utils/create.c
r13800 r13868 136 136 tr_metainfo_builder * b = NULL; 137 137 138 tr_ setMessageLevel (TR_MSG_ERR);138 tr_logSetLevel (TR_LOG_ERROR); 139 139 140 140 if (parseCommandLine (argc, (const char**)argv)) -
trunk/utils/edit.c
r13840 r13868 296 296 files = tr_new0 (const char*, argc); 297 297 298 tr_ setMessageLevel (TR_MSG_ERR);298 tr_logSetLevel (TR_LOG_ERROR); 299 299 300 300 if (parseCommandLine (argc, (const char**)argv)) -
trunk/utils/show.c
r13722 r13868 311 311 tr_ctor * ctor; 312 312 313 tr_ setMessageLevel (TR_MSG_ERR);313 tr_logSetLevel (TR_LOG_ERROR); 314 314 tr_formatter_mem_init (MEM_K, MEM_K_STR, MEM_M_STR, MEM_G_STR, MEM_T_STR); 315 315 tr_formatter_size_init (DISK_K, DISK_K_STR, DISK_M_STR, DISK_G_STR, DISK_T_STR);
Note: See TracChangeset
for help on using the changeset viewer.