Author: mordante
Date: Sun Jul 27 10:59:57 2008
New Revision: 28237
URL: http://svn.gna.org/viewcvs/wesnoth?rev=28237&view=rev
Log:
Write the debug output to a logger insted of std::cerr.
Modified:
trunk/src/formula_function.cpp
Modified: trunk/src/formula_function.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/formula_function.cpp?rev=28237&r1=28236&r2=28237&view=diff
==============================================================================
--- trunk/src/formula_function.cpp (original)
+++ trunk/src/formula_function.cpp Sun Jul 27 10:59:57 2008
@@ -21,9 +21,12 @@
#include "callable_objects.hpp"
#include "formula_callable.hpp"
#include "formula_function.hpp"
+#include "log.hpp"
#include "map.hpp"
#include "SDL.h"
+
+#define DBG_NG LOG_STREAM(debug, engine)
namespace game_logic {
@@ -753,7 +756,7 @@
{
static std::string indent;
indent += " ";
- std::cerr << indent << "executing '" << formula_->str() << "'\n";
+ DBG_NG << indent << "executing '" << formula_->str() << "'\n";
const int begin_time = SDL_GetTicks();
map_formula_callable callable;
for(size_t n = 0; n != arg_names_.size(); ++n) {
@@ -766,16 +769,16 @@
if(precondition_) {
if(!precondition_->execute(callable).as_bool()) {
- std::cerr << "FAILED function precondition for function
'" << formula_->str() << "' with arguments: ";
+ DBG_NG << "FAILED function precondition for function '"
<< formula_->str() << "' with arguments: ";
for(size_t n = 0; n != arg_names_.size(); ++n) {
- std::cerr << " arg " << (n+1) << ": " <<
args()[n]->evaluate(variables).to_debug_string() << "\n";
+ DBG_NG << " arg " << (n+1) << ": " <<
args()[n]->evaluate(variables).to_debug_string() << "\n";
}
}
}
variant res = formula_->execute(callable);
const int taken = SDL_GetTicks() - begin_time;
- std::cerr << indent << "returning: " << taken << "\n";
+ DBG_NG << indent << "returning: " << taken << "\n";
indent.resize(indent.size() - 2);
return res;
@@ -880,11 +883,11 @@
}
}
- std::cerr << "FN: '" << fn << "' " << fn.size() << "\n";
+ DBG_NG << "FN: '" << fn << "' " << fn.size() << "\n";
functions_map::const_iterator i = get_functions_map().find(fn);
if(i == get_functions_map().end()) {
- std::cerr << "no function '" << fn << "'\n";
+ DBG_NG << "no function '" << fn << "'\n";
throw formula_error();
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits