Replace most uses of std::cerr with util::dprint

This commit is contained in:
2023-04-07 16:00:52 -04:00
parent 9d593cc767
commit ef7d0ec365
8 changed files with 7 additions and 22 deletions

View File

@@ -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));
}
}
}