Reorganized some debug code

This commit is contained in:
John Wiegley 2010-06-04 02:54:38 -04:00
parent dbac09405f
commit 2ae2dc86c6

View file

@ -235,19 +235,19 @@ commodity_t::varied_history_t::find_price(const commodity_t& source,
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find", "varied_find_price for: " << source);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG_INDENT("commodity.prices.find", indent + 1);
if (commodity)
DEBUG("commodity.prices.find", "looking for: commodity '" << *commodity << "'");
else
DEBUG("commodity.prices.find", "looking for: any commodity");
if (moment) {
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG("commodity.prices.find", "time index: " << *moment);
}
if (oldest) {
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG("commodity.prices.find", "only consider prices younger than: " << *oldest);
}
#endif
@ -308,6 +308,7 @@ commodity_t::varied_history_t::find_price(const commodity_t& source,
}
assert(! commodity || point->price.commodity() == *commodity);
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG("commodity.prices.find",
"saw a price there: " << point->price << " from " << point->when);
@ -316,6 +317,10 @@ commodity_t::varied_history_t::find_price(const commodity_t& source,
limit = point->when;
best = *point;
found = true;
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG("commodity.prices.find",
"search limit adjusted to " << *limit);
}
} else {
DEBUG_INDENT("commodity.prices.find", indent + 1);
@ -324,9 +329,7 @@ commodity_t::varied_history_t::find_price(const commodity_t& source,
}
if (found) {
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find",
" found price " << best.price << " from " << best.when);
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG("commodity.download",
"found price " << best.price << " from " << best.when);
return best;