Feature/new formatting (#547)

* Change to new logging format (closes #542)
 * Adds a screenshots folder that uses the application startup time
 * Creating focus nodes for VRT files if the info files contain location information
 * Fix issue with removing virtual properties
 * Add a method for returning the cartesian coordinates for a geolocation on a planet
This commit is contained in:
Alexander Bock
2018-03-07 18:10:32 -05:00
committed by GitHub
parent 4675554471
commit a3c849843f
131 changed files with 1229 additions and 751 deletions

View File

@@ -129,8 +129,11 @@ void ScriptEngine::addLibrary(LuaLibrary library) {
if (itf != merged.functions.end()) {
// the function with the desired name is already present, but we don't
// want to overwrite it
LERROR("Lua function '" << fun.name << "' in library '" << library.name <<
"' has been defined twice");
LERROR(fmt::format(
"Lua function '{}' in library '{}' has been defined twice",
fun.name,
library.name
));
return;
}
else {
@@ -192,7 +195,7 @@ bool ScriptEngine::runScriptFile(const std::string& filename) {
return false;
}
if (!FileSys.fileExists(filename)) {
LERROR("Script with name '" << filename << "' did not exist");
LERROR(fmt::format("Script with name '{}' did not exist", filename));
return false;
}
@@ -227,32 +230,34 @@ bool ScriptEngine::isLibraryNameAllowed(lua_State* state, const std::string& nam
result = true;
break;
case LUA_TBOOLEAN:
LERROR("Library name '" << name << "' specifies a boolean");
LERROR(fmt::format("Library name '{}' specifies a boolean", name));
break;
case LUA_TLIGHTUSERDATA:
LERROR("Library name '" << name << "' specifies a light user data");
LERROR(fmt::format("Library name '{}' specifies a light user data", name));
break;
case LUA_TNUMBER:
LERROR("Library name '" << name << "' specifies a number");
LERROR(fmt::format("Library name '{}' specifies a number", name));
break;
case LUA_TSTRING:
LERROR("Library name '" << name << "' specifies a string");
LERROR(fmt::format("Library name '{}' specifies a string", name));
break;
case LUA_TTABLE: {
if (hasLibrary(name))
LERROR("Library with name '" << name << "' has been registered before");
LERROR(fmt::format(
"Library with name '{}' has been registered before", name
));
else
LERROR("Library name '" << name << "' specifies a table");
LERROR(fmt::format("Library name '{}' specifies a table", name));
break;
}
case LUA_TFUNCTION:
LERROR("Library name '" << name << "' specifies a function");
LERROR(fmt::format("Library name '{}' specifies a function", name));
break;
case LUA_TUSERDATA:
LERROR("Library name '" << name << "' specifies a user data");
LERROR(fmt::format("Library name '{}' specifies a user data", name));
break;
case LUA_TTHREAD:
LERROR("Library name '" << name << "' specifies a thread");
LERROR(fmt::format("Library name '{}' specifies a thread", name));
break;
}
@@ -269,7 +274,7 @@ void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library,
lua_getfield(state, -1, p.name.c_str());
const bool isNil = lua_isnil(state, -1);
if (!isNil) {
LERROR("Function name '" << p.name << "' was already assigned");
LERROR(fmt::format("Function name '{}' was already assigned", p.name));
return;
}
lua_pop(state, 1);
@@ -292,9 +297,11 @@ void ScriptEngine::addLibraryFunctions(lua_State* state, LuaLibrary& library,
lua_pushstring(state, "documentation");
lua_gettable(state, -2);
if (lua_isnil(state, -1)) {
LERROR(
"Module '" << library.name << "' did not provide a documentation in " <<
"script file '" << script << "'");
LERROR(fmt::format(
"Module '{}' did not provide a documentation in script file '{}'",
library.name,
script
));
}
else {
lua_pushnil(state);
@@ -592,15 +599,17 @@ bool ScriptEngine::writeLog(const std::string& script) {
_logFilename = absPath(_logFilename);
_logFileExists = true;
LDEBUG("Using script log of type '" << _logType <<
"' to file '" << _logFilename << "'");
LDEBUG(fmt::format(
"Using script log of type '{}' to file '{}'", _logType, _logFilename
));
// Test file and clear previous input
std::ofstream file(_logFilename, std::ofstream::out | std::ofstream::trunc);
if (!file.good()) {
LERROR("Could not open file '" << _logFilename
<< "' for logging scripts");
LERROR(fmt::format(
"Could not open file '{}' for logging scripts", _logFilename
));
return false;
}
@@ -613,7 +622,7 @@ bool ScriptEngine::writeLog(const std::string& script) {
// Simple text output to logfile
std::ofstream file(_logFilename, std::ofstream::app);
if (!file.good()) {
LERROR("Could not open file '" << _logFilename << "' for logging scripts");
LERROR(fmt::format("Could not open file '{}' for logging scripts", _logFilename));
return false;
}