Replace most uses of std::cerr with util::dprint
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "luastack.hpp"
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <climits>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "util.hpp"
|
||||
#include "table.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
|
||||
class PrintMachine {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
LuaDefine(makeclass, "classname", "create a class if it doesn't already exist") {
|
||||
LuaArg classname;
|
||||
@@ -378,14 +377,14 @@ void SourceDB::run_unittests() {
|
||||
// Run the functions in order
|
||||
bool any = false;
|
||||
for (const eng::string &name : names) {
|
||||
std::cerr << "Running unittests." << name << std::endl;
|
||||
util::dprint("Running unittests: ", name);
|
||||
LS.rawget(func, unittests, name);
|
||||
|
||||
lua_pushvalue(L, func.index());
|
||||
eng::string msg = traceback_pcall(L, 0, 0);
|
||||
if (!msg.empty()) {
|
||||
LS.set(err, msg);
|
||||
std::cerr << msg << std::endl;
|
||||
util::dprint(msg);
|
||||
any = true;
|
||||
}
|
||||
}
|
||||
@@ -500,7 +499,7 @@ void SourceDB::register_lua_builtins() {
|
||||
if (reg->get_func() == nullptr) {
|
||||
if (builtin == nullptr) {
|
||||
if (!reg->get_sandbox()) {
|
||||
std::cerr << "No such builtin function: " << classname << " " << funcname << std::endl;
|
||||
util::dprint("No such builtin function: ", classname, " ", funcname);
|
||||
}
|
||||
} else {
|
||||
reg->set_func(builtin);
|
||||
@@ -516,8 +515,7 @@ void SourceDB::register_lua_builtins() {
|
||||
LS.set(lfuncname, LuaNil);
|
||||
while (LS.next(classtab, lfuncname, func)) {
|
||||
if (LS.iscfunction(func)) {
|
||||
std::cerr << "Failed to declare builtin: " << LS.ckstring(lclassname) << "."
|
||||
<< LS.ckstring(lfuncname) << std::endl;
|
||||
util::dprint("Failed to declare builtin: ", LS.ckstring(lclassname), ".", LS.ckstring(lfuncname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "pprint.hpp"
|
||||
#include "serializelua.hpp"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
static void tangible_getall(LuaCoreStack &LS0, LuaSlot list, const util::IdVector &idv) {
|
||||
LuaVar tangibles, tan;
|
||||
|
||||
@@ -355,7 +355,7 @@ void World::update_gui(int64_t actor_id, int64_t place_id, Gui *gui) {
|
||||
Gui::store_global_pointer(L, nullptr);
|
||||
if (!msg.empty()) {
|
||||
gui->clear(0);
|
||||
std::cerr << msg << std::endl;
|
||||
util::dprint(msg);
|
||||
LS.result();
|
||||
return;
|
||||
}
|
||||
@@ -376,10 +376,7 @@ void World::update_source(const util::LuaSourceVec &source) {
|
||||
source_db_.update(source);
|
||||
assert(stack_is_clear());
|
||||
eng::string errs = source_db_.rebuild();
|
||||
// I don't have a good place to send the error messages right
|
||||
// now. The engine needs a catch-all place to send errors that
|
||||
// occur at unexpected times.
|
||||
std::cerr << errs;
|
||||
util::dprint(errs);
|
||||
assert(stack_is_clear());
|
||||
}
|
||||
|
||||
@@ -976,8 +973,6 @@ void World::serialize(StreamBuffer *sb) {
|
||||
sb->write_int64(p.first);
|
||||
p.second->serialize(sb);
|
||||
}
|
||||
// int64_t wc1 = sb->total_writes();
|
||||
// std::cerr << "World serialized to " << wc1-wc0 << " bytes." << std::endl;
|
||||
assert(stack_is_clear());
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "streambuffer.hpp"
|
||||
#include "table.hpp"
|
||||
#include "world.hpp"
|
||||
#include <iostream>
|
||||
|
||||
// Given a table and an tnmap, return the table number of the table.
|
||||
// Returns zero if the table doesn't have a table number.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "world.hpp"
|
||||
|
||||
@@ -294,9 +293,7 @@ void World::patch_source(StreamBuffer *sb, DebugCollector *dbc) {
|
||||
if (modified) {
|
||||
eng::string errs = source_db_.rebuild();
|
||||
DebugLine(dbc) << "Source DB rebuilt";
|
||||
// TODO: I don't currently have any good place to send the
|
||||
// error messages. This is a stopgap.
|
||||
std::cerr << errs;
|
||||
util::dprint(errs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user