More debug code cleanup

This commit is contained in:
John Wiegley 2010-06-04 03:23:31 -04:00
parent 7f7243ff93
commit b7e8cb9d54

View file

@ -159,7 +159,7 @@ commodity_t::history_t::find_price(const optional<datetime_t>& moment,
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find", "using most recent price");
} else {
history_map::const_iterator i = prices.lower_bound(*moment);
history_map::const_iterator i = prices.upper_bound(*moment);
if (i == prices.end()) {
history_map::const_reverse_iterator r = prices.rbegin();
point.when = (*r).first;
@ -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 + 1);
DEBUG_INDENT("commodity.prices.find", indent);
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 + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find", "time index: " << *moment);
}
if (oldest) {
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find", "only consider prices younger than: " << *oldest);
}
#endif
@ -268,13 +268,13 @@ commodity_t::varied_history_t::find_price(const commodity_t& source,
if (! commodity && ! comm.has_flags(COMMODITY_PRIMARY))
continue;
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find",
"searching for price via commodity '" << comm << "'");
point = hist.second.find_price(moment, limit
#if defined(DEBUG_ON)
, indent + 2
, indent + 1
#endif
);
assert(! point || point->price.commodity() == comm);
@ -283,16 +283,16 @@ commodity_t::varied_history_t::find_price(const commodity_t& source,
optional<price_point_t> xlat;
if (commodity && comm != *commodity) {
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find", "looking for translation price");
xlat = comm.find_price(commodity, moment, limit
#if defined(DEBUG_ON)
, indent + 2
, indent + 1
#endif
);
if (xlat) {
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find", "found translated price "
<< xlat->price << " from " << xlat->when);
@ -300,12 +300,12 @@ commodity_t::varied_history_t::find_price(const commodity_t& source,
if (xlat->when < point->when) {
point->when = xlat->when;
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find",
"adjusting date of result back to " << point->when);
}
} else {
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find", "saw no translated price there");
continue;
}
@ -313,7 +313,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_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find",
"saw a price there: " << point->price << " from " << point->when);
@ -322,18 +322,18 @@ commodity_t::varied_history_t::find_price(const commodity_t& source,
best = *point;
found = true;
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find",
"search limit adjusted to " << *limit);
}
} else {
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.prices.find", "saw no price there");
}
}
if (found) {
DEBUG_INDENT("commodity.prices.find", indent + 1);
DEBUG_INDENT("commodity.prices.find", indent);
DEBUG("commodity.download",
"found price " << best.price << " from " << best.when);
return best;