From bbe4d43fdda95dcd09fc1ff38969cecc4636b751 Mon Sep 17 00:00:00 2001 From: Tomas Maly Date: Wed, 30 Oct 2024 20:43:53 +0100 Subject: [PATCH] logging without ' --- sources/asset-analyze/main.cpp | 8 +- sources/asset-database/databank.cpp | 16 ++-- sources/asset-database/processing.cpp | 20 ++--- sources/asset-database/scheme.cpp | 32 ++++---- sources/asset-processor/animation.cpp | 2 +- sources/asset-processor/main.cpp | 12 +-- sources/asset-processor/shader.cpp | 80 +++++++++---------- sources/image-channels/main.cpp | 8 +- sources/image-convert/main.cpp | 2 +- sources/image-info/main.cpp | 2 +- sources/image-untile/main.cpp | 4 +- sources/libcore/config.cpp | 8 +- sources/libcore/ini.cpp | 8 +- sources/libcore/mesh/importAssimp.cpp | 8 +- sources/libcore/string.cpp | 12 +-- .../virtualReality/controllerBindings.cpp | 2 +- sources/libengine/window/gamepad.cpp | 2 +- sources/libsimple/fullscreenSwitcher.cpp | 6 +- sources/mesh-info/main.cpp | 2 +- sources/test-core/files.cpp | 2 +- sources/test-ginnel/client.cpp | 2 +- 21 files changed, 119 insertions(+), 119 deletions(-) diff --git a/sources/asset-analyze/main.cpp b/sources/asset-analyze/main.cpp index 535e7a86..13f97667 100644 --- a/sources/asset-analyze/main.cpp +++ b/sources/asset-analyze/main.cpp @@ -30,7 +30,7 @@ namespace AssetsLists analyzeFile(const String &path) { - CAGE_LOG(SeverityEnum::Info, "analyze", String() + "analyzing file '" + path + "'"); + CAGE_LOG(SeverityEnum::Info, "analyze", String() + "analyzing file: " + path); try { Holder prg = newProcess(String() + "cage-asset-processor analyze " + path); @@ -45,7 +45,7 @@ namespace detail::OverrideBreakpoint ob; line = prg->readLine(); } - CAGE_LOG_DEBUG(SeverityEnum::Info, "process", Stringizer() + "message '" + line + "'"); + CAGE_LOG_DEBUG(SeverityEnum::Info, "process", Stringizer() + "message: " + line); if (line == "cage-stop") break; else if (line == "cage-begin") @@ -80,14 +80,14 @@ namespace } catch (...) { - CAGE_LOG(SeverityEnum::Warning, "analyze", String() + "an error occurred while analyzing file '" + path + "'"); + CAGE_LOG(SeverityEnum::Warning, "analyze", String() + "an error occurred while analyzing file: " + path); } return {}; } void analyzeFolder(const String &path) { - CAGE_LOG(SeverityEnum::Info, "analyze", String() + "analyzing directory '" + path + "'"); + CAGE_LOG(SeverityEnum::Info, "analyze", String() + "analyzing directory: " + path); std::set files, directories; const auto list = pathListDirectory(path); diff --git a/sources/asset-database/databank.cpp b/sources/asset-database/databank.cpp index 64024c42..885772e1 100644 --- a/sources/asset-database/databank.cpp +++ b/sources/asset-database/databank.cpp @@ -86,7 +86,7 @@ bool databankParse(const String &databank) } catch (cage::Exception &) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "invalid databank ini file '" + databank + "'"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "invalid databank ini file: " + databank); return false; } @@ -98,13 +98,13 @@ bool databankParse(const String &databank) const String scheme = ini->getString(section, "scheme"); if (scheme.empty()) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "undefined scheme in databank '" + databank + "' in section '" + section + "'"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "undefined scheme in databank: " + databank + ", in section: " + section); errors++; continue; } if (schemes.count(scheme) == 0) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "invalid scheme '" + scheme + "' in databank '" + databank + "' in section '" + section + "'"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "invalid scheme: " + scheme + ", in databank: " + databank + ", in section: " + section); errors++; continue; } @@ -135,7 +135,7 @@ bool databankParse(const String &databank) if (assets.count(ass->name) > 0) { const auto &ass2 = assets[ass->name]; - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "duplicate asset name '" + ass->name + "' in databank '" + databank + "' in section '" + section + "' with asset in databank '" + ass2->databank + "'"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "duplicate asset name: " + ass->name + ", in databank: " + databank + ", in section: " + section + ", with asset in databank: " + ass2->databank); errors++; continue; } @@ -158,7 +158,7 @@ bool databankParse(const String &databank) String s, t, v; if (ini->anyUnused(s, t, v)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "unused property/asset '" + t + "' = '" + v + "' in databank '" + databank + "' in section '" + s + "'"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "unused property/asset: " + t + " = " + v + ", in databank: " + databank + ", in section: " + s); errors++; } } @@ -198,7 +198,7 @@ void databanksLoad() return; } - CAGE_LOG(SeverityEnum::Info, "database", Stringizer() + "loading database cache: '" + (String)configPathDatabase + "'"); + CAGE_LOG(SeverityEnum::Info, "database", Stringizer() + "loading database cache: " + (String)configPathDatabase); if (!pathIsFile(configPathDatabase)) { CAGE_LOG(SeverityEnum::Info, "database", "database cache does not exist, starting from scratch"); @@ -238,7 +238,7 @@ void databanksSave() // save database if (!((String)configPathDatabase).empty()) { - CAGE_LOG(SeverityEnum::Info, "database", Stringizer() + "saving database cache: '" + (String)configPathDatabase + "'"); + CAGE_LOG(SeverityEnum::Info, "database", Stringizer() + "saving database cache: " + (String)configPathDatabase); MemoryBuffer buf; Serializer ser(buf); ser << databaseBegin; @@ -323,7 +323,7 @@ namespace void findFiles(std::map &files, const String &path) { const String pth = pathJoin(configPathInput, path); - CAGE_LOG(SeverityEnum::Info, "database", Stringizer() + "checking path '" + pth + "'"); + CAGE_LOG(SeverityEnum::Info, "database", Stringizer() + "checking path: " + pth); const auto list = pathListDirectory(pth); for (const String &p : list) { diff --git a/sources/asset-database/processing.cpp b/sources/asset-database/processing.cpp index 8f8fdf69..dd9bf56d 100644 --- a/sources/asset-database/processing.cpp +++ b/sources/asset-database/processing.cpp @@ -88,12 +88,12 @@ namespace { if (pathIsAbs(line)) { - CAGE_LOG_THROW(Stringizer() + "path: '" + line + "'"); + CAGE_LOG_THROW(Stringizer() + "path: " + line); CAGE_THROW_ERROR(Exception, "assets use path must be relative"); } if (!pathIsFile(pathJoin(pathToAbs(configPathInput), line))) { - CAGE_LOG_THROW(Stringizer() + "path: '" + line + "'"); + CAGE_LOG_THROW(Stringizer() + "path: " + line); CAGE_THROW_ERROR(Exception, "assets use path does not exist"); } ass.files.insert(line); @@ -102,7 +102,7 @@ namespace ass.references.insert(line); else { - CAGE_LOG_THROW(Stringizer() + "parameter: '" + param + "', value: '" + line + "'"); + CAGE_LOG_THROW(Stringizer() + "parameter: " + param + ", value: " + line); CAGE_THROW_ERROR(Exception, "unknown parameter name"); } } @@ -122,12 +122,12 @@ namespace } catch (const Exception &e) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "processing asset '" + ass.name + "' failed"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "failed processing asset: " + ass.name); } catch (...) { detail::logCurrentCaughtException(); - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "unknown exception while processing asset '" + ass.name + "'"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "unknown exception while processing asset: " + ass.name); } } @@ -162,8 +162,8 @@ namespace } // find new or modified databanks - const auto corruptedDbsCopy = std::move(corruptedDatabanks); - CAGE_ASSERT(corruptedDatabanks.empty()); + std::set corruptedDbsCopy; + std::swap(corruptedDbsCopy, corruptedDatabanks); for (const auto &f : files) { if (!isNameDatabank(f.first)) @@ -192,7 +192,7 @@ namespace if (outputHashes.count(outputHash) > 0) { auto &ass2 = *outputHashes[outputHash]; - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + ass.name + "' in databank '" + ass.databank + "' has name hash collision with asset '" + ass2.name + "' in databank '" + ass2.databank + "'"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + ass.name + ", in databank: " + ass.databank + ", has name hash collision with asset: " + ass2.name + ", in databank: " + ass2.databank); ass.corrupted = true; ass2.corrupted = true; } @@ -211,7 +211,7 @@ namespace if (assets.count(it) == 0 && injectedNames.count(HashString(it)) == 0) { anyMissing = true; - CAGE_LOG(SeverityEnum::Warning, "database", Stringizer() + "asset '" + ass.name + "' in databank '" + ass.databank + "' is missing reference '" + it + "'"); + CAGE_LOG(SeverityEnum::Warning, "database", Stringizer() + "asset: " + ass.name + ", in databank: " + ass.databank + ", is missing reference: " + it); } } if (anyMissing) @@ -254,7 +254,7 @@ void checkAssets() for (const auto &it : assets) if (it.second->corrupted) asses.push_back(+it.second); - tasksRunBlocking("processing", Delegate().bind<&processAsset>(), asses); + tasksRunBlocking("processing", Delegate().bind(), asses); } validateAssets(); diff --git a/sources/asset-database/scheme.cpp b/sources/asset-database/scheme.cpp index c31c0e55..ca7a36a2 100644 --- a/sources/asset-database/scheme.cpp +++ b/sources/asset-database/scheme.cpp @@ -222,7 +222,7 @@ bool SchemeField::applyToAssetField(String &val, const String &assetName) const { if (defaul.empty() && type != "string") { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "' is a required property"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", is a required"); return false; } val = defaul; @@ -232,7 +232,7 @@ bool SchemeField::applyToAssetField(String &val, const String &assetName) const { if (!isBool(val)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is not bool"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is not bool"); return false; } val = Stringizer() + toBool(val); @@ -241,17 +241,17 @@ bool SchemeField::applyToAssetField(String &val, const String &assetName) const { if (val.empty() || !isDigitsOnly(val)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is not integer"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is not integer"); return false; } if (!min.empty() && toUint32(val) < toUint32(min)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is too small"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is too small"); return false; } if (!max.empty() && toUint32(val) > toUint32(max)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is too large"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is too large"); return false; } } @@ -259,17 +259,17 @@ bool SchemeField::applyToAssetField(String &val, const String &assetName) const { if (!isInteger(val)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is not integer"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is not integer"); return false; } if (!min.empty() && toSint32(val) < toSint32(min)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is too small"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is too small"); return false; } if (!max.empty() && toSint32(val) > toSint32(max)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is too large"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is too large"); return false; } } @@ -277,17 +277,17 @@ bool SchemeField::applyToAssetField(String &val, const String &assetName) const { if (!isReal(val)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is not real"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is not real"); return false; } if (!min.empty() && toDouble(val) < toDouble(min)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is too small"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is too small"); return false; } if (!max.empty() && toDouble(val) > toDouble(max)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is too large"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is too large"); return false; } } @@ -295,12 +295,12 @@ bool SchemeField::applyToAssetField(String &val, const String &assetName) const { if (!min.empty() && val.length() < toUint32(min)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is too short"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is too short"); return false; } if (!max.empty() && val.length() > toUint32(max)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is too long"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is too long"); return false; } } @@ -308,12 +308,12 @@ bool SchemeField::applyToAssetField(String &val, const String &assetName) const { if (find(val, ',') != m) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' contains comma"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", contains comma"); return false; } if (!valuesContainsValue(values, val)) { - CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset '" + assetName + "', field '" + this->name + "', value '" + val + "' is not listed in values"); + CAGE_LOG(SeverityEnum::Error, "database", Stringizer() + "asset: " + assetName + ", property: " + name + ", value: " + val + ", is not listed in values"); return false; } } @@ -337,7 +337,7 @@ namespace continue; Holder s = systemMemory().createHolder(); s->name = pathExtractFilenameNoExtension(name); - CAGE_LOG(SeverityEnum::Info, "database", Stringizer() + "loading scheme '" + s->name + "'"); + CAGE_LOG(SeverityEnum::Info, "database", Stringizer() + "loading scheme: " + s->name); Holder ini = newIni(); ini->importFile(name); s->parse(+ini); diff --git a/sources/asset-processor/animation.cpp b/sources/asset-processor/animation.cpp index 4e5491d5..1e728f6a 100644 --- a/sources/asset-processor/animation.cpp +++ b/sources/asset-processor/animation.cpp @@ -39,7 +39,7 @@ void processAnimation() n = inputFile + ";skeleton"; else n = pathJoin(pathExtractDirectory(inputName), n); - CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "using skeleton name: '" + n + "'"); + CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "using skeleton name: " + n); writeLine(String("ref = ") + n); return HashString(n); }(); diff --git a/sources/asset-processor/main.cpp b/sources/asset-processor/main.cpp index edf059be..d94c89f3 100644 --- a/sources/asset-processor/main.cpp +++ b/sources/asset-processor/main.cpp @@ -145,11 +145,11 @@ String convertFilePath(const String &input, const String &relativeTo, bool markA void writeLine(const String &other) { - CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "writing: '" + other + "'"); + CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "writing: " + other); { String b = other; if (trim(split(b, "=")) == "ref") - CAGE_LOG(SeverityEnum::Note, "assetProcessor", Stringizer() + "reference hash: '" + (uint32)HashString(trim(b)) + "'"); + CAGE_LOG(SeverityEnum::Note, "assetProcessor", Stringizer() + "reference hash: " + (uint32)HashString(trim(b))); } if (fprintf(stdout, "%s\n", other.c_str()) < 0) CAGE_THROW_ERROR(SystemError, "fprintf", ferror(stdout)); @@ -162,7 +162,7 @@ String properties(const String &name) return it->second; else { - CAGE_LOG_THROW(Stringizer() + "property name: '" + name + "'"); + CAGE_LOG_THROW(Stringizer() + "property name: " + name); CAGE_THROW_ERROR(Exception, "property not found"); } } @@ -174,7 +174,7 @@ int main(int argc, const char *args[]) if (argc == 3 && String(args[1]) == "analyze") { initializeSecondaryLog(pathJoin(configGetString("cage-asset-processor/analyzeLog/path", "analyze-log"), pathReplaceInvalidCharacters(args[2]) + ".log")); - CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "analyzing input '" + args[2] + "'"); + CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "analyzing input: " + args[2]); inputDirectory = pathExtractDirectory(args[2]); inputName = pathExtractFilename(args[2]); derivedProperties(); @@ -188,9 +188,9 @@ int main(int argc, const char *args[]) initializeSecondaryLog(pathJoin(configGetString("cage-asset-processor/processLog/path", "process-log"), pathReplaceInvalidCharacters(inputName) + ".log")); for (const auto &it : props) - CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "property '" + it.first + "': '" + it.second + "'"); + CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "property: " + it.first + " = " + it.second); -#define GCHL_GENERATE(N) CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "input " #N ": '" + N + "'"); +#define GCHL_GENERATE(N) CAGE_LOG(SeverityEnum::Info, "assetProcessor", Stringizer() + "input: " #N " = " + N); GCHL_GENERATE(inputFileName); GCHL_GENERATE(outputFileName); GCHL_GENERATE(inputFile); diff --git a/sources/asset-processor/shader.cpp b/sources/asset-processor/shader.cpp index 5cf28217..e9b9e77e 100644 --- a/sources/asset-processor/shader.cpp +++ b/sources/asset-processor/shader.cpp @@ -185,9 +185,9 @@ namespace return String({ &left[index], &left[index] + 1 }); } { - CAGE_LOG_THROW(Stringizer() + "expression: '" + l + "'"); - CAGE_LOG_THROW(Stringizer() + "string: '" + left + "'"); - CAGE_LOG_THROW(Stringizer() + "index: '" + right + "'"); + CAGE_LOG_THROW(Stringizer() + "expression: " + l); + CAGE_LOG_THROW(Stringizer() + "string: " + left); + CAGE_LOG_THROW(Stringizer() + "index: " + right); CAGE_THROW_ERROR(Exception, "non integer index or out of bounds"); } } @@ -214,15 +214,15 @@ namespace uint32 o = find(reverse(subString(l, 0, z)), '('); if (o == m) { - CAGE_LOG_THROW(Stringizer() + "expression: '" + input + "'"); - CAGE_THROW_ERROR(Exception, "unmatched ')'"); + CAGE_LOG_THROW(Stringizer() + "expression: " + input); + CAGE_THROW_ERROR(Exception, "unmatched )"); } l = replace(l, z - o - 1, o + 2, evalExp(subString(l, z - o, o))); } if (find(l, '(') != m) { - CAGE_LOG_THROW(Stringizer() + "expression: '" + input + "'"); - CAGE_THROW_ERROR(Exception, "unmatched '('"); + CAGE_LOG_THROW(Stringizer() + "expression: " + input); + CAGE_THROW_ERROR(Exception, "unmatched ("); } return evalExp(l); } @@ -233,7 +233,7 @@ namespace { if (!s.empty()) { - CAGE_LOG_DEBUG(SeverityEnum::Warning, "assetProcessor", Stringizer() + "output to unspecified shader: '" + s + "'"); + CAGE_LOG_DEBUG(SeverityEnum::Warning, "assetProcessor", Stringizer() + "output to unspecified shader: " + s); } return; } @@ -297,13 +297,13 @@ namespace if (cmd == "if") { if (line.empty()) - CAGE_THROW_ERROR(Exception, "'$if' missing parameters"); + CAGE_THROW_ERROR(Exception, "$if missing parameters"); stack.push_back(evalExpToBool(eval(line)) ? 1 : 0); } else if (cmd == "once") { if (!line.empty()) - CAGE_THROW_ERROR(Exception, "'$once' cannot have parameters"); + CAGE_THROW_ERROR(Exception, "$once cannot have parameters"); String name = Stringizer() + filename + ":" + lineNumber; stack.push_back(onces.find(name) == onces.end() ? 1 : 0); onces.insert(name); @@ -311,9 +311,9 @@ namespace else if (cmd == "else") { if (!line.empty()) - CAGE_THROW_ERROR(Exception, "'$else' cannot have parameters"); + CAGE_THROW_ERROR(Exception, "$else cannot have parameters"); if (stack.empty()) - CAGE_THROW_ERROR(Exception, "unexpected '$else'"); + CAGE_THROW_ERROR(Exception, "unexpected $else"); sint32 v = stack.back(); stack.pop_back(); switch (v) @@ -334,15 +334,15 @@ namespace else if (cmd == "end" || cmd == "endif") { if (!line.empty()) - CAGE_THROW_ERROR(Exception, "'$end' cannot have parameters"); + CAGE_THROW_ERROR(Exception, "$end cannot have parameters"); if (stack.empty()) - CAGE_THROW_ERROR(Exception, "unexpected '$end'"); + CAGE_THROW_ERROR(Exception, "unexpected $end"); stack.pop_back(); } else if (cmd == "stack") { if (!line.empty()) - CAGE_THROW_ERROR(Exception, "'$stack' cannot have parameters"); + CAGE_THROW_ERROR(Exception, "$stack cannot have parameters"); String s("// CAGE: stack:"); for (const auto &it : stack) s += Stringizer() + " " + it; @@ -355,26 +355,26 @@ namespace String name = split(line); if (name.empty() || line.empty()) { - CAGE_LOG_THROW(Stringizer() + "name: '" + name + "'"); - CAGE_THROW_ERROR(Exception, "'$define/set' expects two parameters"); + CAGE_LOG_THROW(Stringizer() + "name: " + name); + CAGE_THROW_ERROR(Exception, "$define/set expects two parameters"); } if (!validDefine(name)) { - CAGE_LOG_THROW(Stringizer() + "name: '" + name + "', value: '" + line + "'"); - CAGE_THROW_ERROR(Exception, "'$define/set' with invalid name"); + CAGE_LOG_THROW(Stringizer() + "name: " + name + ", value: " + line); + CAGE_THROW_ERROR(Exception, "$define/set with invalid name"); } if (cmd == "set") line = eval(line); if (name == "shader" && shaderType(line) == 0) - CAGE_THROW_ERROR(Exception, "'$define/set shader ...' must be one of vertex, fragment, geometry, control, evaluation or compute"); + CAGE_THROW_ERROR(Exception, "$define/set shader must be one of vertex, fragment, geometry, control, evaluation, or compute"); defines[name] = line; } else if (cmd == "undef") { if (!validDefine(line)) { - CAGE_LOG_THROW(Stringizer() + "name: '" + line + "'"); - CAGE_THROW_ERROR(Exception, "'$undef' with invalid name"); + CAGE_LOG_THROW(Stringizer() + "name: " + line); + CAGE_THROW_ERROR(Exception, "$undef with invalid name"); } defines.erase(line); } @@ -382,13 +382,13 @@ namespace { if (!validDefine(line)) { - CAGE_LOG_THROW(Stringizer() + "name: '" + line + "'"); - CAGE_THROW_ERROR(Exception, "'$print' with invalid name"); + CAGE_LOG_THROW(Stringizer() + "name: " + line); + CAGE_THROW_ERROR(Exception, "$print with invalid name"); } if (defines.find(line) == defines.end()) { - CAGE_LOG_THROW(Stringizer() + "name: '" + line + "'"); - CAGE_THROW_ERROR(Exception, "'$print' with unknown name"); + CAGE_LOG_THROW(Stringizer() + "name: " + line); + CAGE_THROW_ERROR(Exception, "$print with unknown name"); } output(defines[line]); } @@ -399,31 +399,31 @@ namespace else if (cmd == "variables") { if (!line.empty()) - CAGE_THROW_ERROR(Exception, "'$variables' expects no parameters"); + CAGE_THROW_ERROR(Exception, "$variables expects no parameters"); for (const auto &it : defines) - output(String() + "// CAGE: variable: '" + it.first + "' = '" + it.second + "'"); + output(String() + "// CAGE: variable: " + it.first + " = " + it.second); } else if (cmd == "include") { if (line.empty()) - CAGE_THROW_ERROR(Exception, "'$include' expects one parameter"); + CAGE_THROW_ERROR(Exception, "$include expects one parameter"); line = convertFilePath(pathIsAbs(line) ? line : pathJoin(filename + "/..", line)); const String fn = pathJoin(inputDirectory, line); if (!pathIsFile(fn)) { - CAGE_LOG_THROW(Stringizer() + "requested file '" + line + "'"); - CAGE_THROW_ERROR(Exception, "'$include' file not found"); + CAGE_LOG_THROW(Stringizer() + "requested file: " + line); + CAGE_THROW_ERROR(Exception, "$include file not found"); } if (configShaderPrint) - output(Stringizer() + "// CAGE: include file: '" + line + "'"); + output(Stringizer() + "// CAGE: include file: " + line); parse(fn); if (configShaderPrint) - output(Stringizer() + "// CAGE: return to file: '" + pathToRel(filename, inputDirectory) + "':" + lineNumber); + output(Stringizer() + "// CAGE: return to file: " + pathToRel(filename, inputDirectory) + ":" + lineNumber); } else { - CAGE_LOG_THROW(Stringizer() + "command: '" + cmd + "', params: '" + line + "'"); - CAGE_THROW_ERROR(Exception, "unknown '$' command"); + CAGE_LOG_THROW(Stringizer() + "command: " + cmd + ", params: " + line); + CAGE_THROW_ERROR(Exception, "unknown $ command"); } } } @@ -437,7 +437,7 @@ namespace if (cmd == "ifdef" || cmd == "ifndef") { if (line.empty()) - CAGE_THROW_ERROR(Exception, "'#ifdef' missing parameter"); + CAGE_THROW_ERROR(Exception, "#ifdef missing parameter"); keywords.insert(line); } } @@ -446,16 +446,16 @@ namespace } catch (...) { - CAGE_LOG_THROW(Stringizer() + "in file: '" + filename + "':" + lineNumber); - CAGE_LOG_THROW(Stringizer() + "original line: '" + originalLine + "'"); + CAGE_LOG_THROW(Stringizer() + "in file: " + filename + ":" + lineNumber); + CAGE_LOG_THROW(Stringizer() + "original line: " + originalLine); throw; } } if (!stack.empty()) { - CAGE_LOG_THROW(Stringizer() + "in file: '" + filename + "':" + lineNumber); - CAGE_THROW_ERROR(Exception, "unexpected end of file; expecting '$end'"); + CAGE_LOG_THROW(Stringizer() + "in file: " + filename + ":" + lineNumber); + CAGE_THROW_ERROR(Exception, "unexpected end of file; expecting $end"); } } } diff --git a/sources/image-channels/main.cpp b/sources/image-channels/main.cpp index d1bbd824..d7b803c7 100644 --- a/sources/image-channels/main.cpp +++ b/sources/image-channels/main.cpp @@ -11,7 +11,7 @@ constexpr uint32 MaxChannels = 8; void doSplit(const String names[MaxChannels], const String &input) { - CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "loading image: '" + input + "'"); + CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "loading image: " + input); Holder in = newImage(); in->importFile(input); CAGE_LOG(SeverityEnum::Info, "image", "splitting"); @@ -26,7 +26,7 @@ void doSplit(const String names[MaxChannels], const String &input) CAGE_LOG_THROW(Stringizer() + "requested channel index: " + index); CAGE_THROW_ERROR(Exception, "input image does not have specified channel"); } - CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "saving image: '" + names[index] + "'"); + CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "saving image: " + names[index]); CAGE_ASSERT(images[index]->channels() == 1); images[index]->exportFile(names[index]); outputs++; @@ -64,7 +64,7 @@ void doJoin(const String names[MaxChannels], const String &output, const bool mo continue; highest = index; inputs[index] = newImage(); - CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "loading image: '" + names[index] + "' for " + (index + 1) + "th channel"); + CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "loading image: " + names[index] + ", for " + (index + 1) + "th channel"); inputs[index]->importFile(names[index]); if (inputs[index]->channels() != 1) { @@ -77,7 +77,7 @@ void doJoin(const String names[MaxChannels], const String &output, const bool mo CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "joining"); Holder image = imageChannelsJoin(inputs); imageConvert(+image, highest + 1); - CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "saving image: '" + output + "'"); + CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "saving image: " + output); image->exportFile(output); CAGE_LOG(SeverityEnum::Info, "image", "ok"); } diff --git a/sources/image-convert/main.cpp b/sources/image-convert/main.cpp index 7a1733cc..814dbf7b 100644 --- a/sources/image-convert/main.cpp +++ b/sources/image-convert/main.cpp @@ -13,7 +13,7 @@ void convert(String src, const String &format, bool preserveOriginal) src = pathSimplify(src); const String path = pathExtractDirectory(src); const String dst = pathJoin(path, pathExtractFilenameNoExtension(src) + format); - CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "converting '" + src + "' to '" + dst + "'"); + CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "converting: " + src + ", to " + dst); if (src == dst) { CAGE_LOG(SeverityEnum::Info, "image", "no conversion required"); diff --git a/sources/image-info/main.cpp b/sources/image-info/main.cpp index 7ead6e6d..3df404eb 100644 --- a/sources/image-info/main.cpp +++ b/sources/image-info/main.cpp @@ -11,7 +11,7 @@ using namespace cage; void info(const String &src) { - CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "opening image '" + src + "'"); + CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "opening image: " + src); ImageImportResult result; try { diff --git a/sources/image-untile/main.cpp b/sources/image-untile/main.cpp index 99afc97f..56ff002f 100644 --- a/sources/image-untile/main.cpp +++ b/sources/image-untile/main.cpp @@ -12,7 +12,7 @@ void cutImage(const Holder &in, uint32 x, uint32 y, uint32 w, uint32 h, c CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "cutting image at: " + x + ", " + y); Holder out = newImage(); imageBlit(in.get(), out.get(), x, y, 0, 0, w, h); - CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "saving to: '" + name + "'"); + CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "saving to: " + name); out->exportFile(name); } @@ -21,7 +21,7 @@ void untile(const String &input, const String &output, uint32 x, uint32 y, uint3 if (w == 0 || h == 0) CAGE_THROW_ERROR(Exception, "width and height may not be zero"); - CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "loading image: '" + input + "'"); + CAGE_LOG(SeverityEnum::Info, "image", Stringizer() + "loading image: " + input); Holder in = newImage(); in->importFile(input); const uint32 inw = in->width(); diff --git a/sources/libcore/config.cpp b/sources/libcore/config.cpp index 82998297..7b0414ef 100644 --- a/sources/libcore/config.cpp +++ b/sources/libcore/config.cpp @@ -406,16 +406,16 @@ namespace cage void configApplyIni(const Ini *ini, const String &prefix) { if (find(prefix, '/') != m || prefix.empty()) - CAGE_LOG(SeverityEnum::Warning, "config", Stringizer() + "dangerous config prefix '" + prefix + "'"); + CAGE_LOG(SeverityEnum::Warning, "config", Stringizer() + "dangerous config prefix: " + prefix); const String pref = prefix.empty() ? "" : prefix + "/"; for (const String §ion : ini->sections()) { if (prefix.empty() && find(section, '/') != m) - CAGE_LOG(SeverityEnum::Warning, "config", Stringizer() + "dangerous config section '" + section + "'"); + CAGE_LOG(SeverityEnum::Warning, "config", Stringizer() + "dangerous config section: " + section); for (const String &name : ini->items(section)) { if (prefix.empty() && find(name, '/') != m) - CAGE_LOG(SeverityEnum::Warning, "config", Stringizer() + "dangerous config field '" + name + "'"); + CAGE_LOG(SeverityEnum::Warning, "config", Stringizer() + "dangerous config field: " + name); const String value = ini->getString(section, name); configSetDynamic(Stringizer() + pref + section + "/" + name, value); } @@ -425,7 +425,7 @@ namespace cage Holder configGenerateIni(const String &prefix) { if (find(prefix, '/') != m || prefix.empty()) - CAGE_LOG(SeverityEnum::Warning, "config", Stringizer() + "dangerous config prefix '" + prefix + "'"); + CAGE_LOG(SeverityEnum::Warning, "config", Stringizer() + "dangerous config prefix: " + prefix); Holder ini = newIni(); Holder cnf = newConfigList(); while (cnf->valid()) diff --git a/sources/libcore/ini.cpp b/sources/libcore/ini.cpp index 52d480e1..5c7f1927 100644 --- a/sources/libcore/ini.cpp +++ b/sources/libcore/ini.cpp @@ -225,7 +225,7 @@ namespace cage String section, item, value; if (anyUnused(section, item, value)) { - CAGE_LOG_THROW(Stringizer() + "section: '" + section + "', item: '" + item + "', " + "value: '" + value + "'"); + CAGE_LOG_THROW(Stringizer() + "section: " + section + ", item: " + item + ", value: " + value); CAGE_THROW_ERROR(Exception, "unused ini/config item"); } } @@ -365,7 +365,7 @@ namespace cage sec = Stringizer() + secIndex++; if (sectionExists(sec)) { - CAGE_LOG_THROW(Stringizer() + "section: '" + sec + "'"); + CAGE_LOG_THROW(Stringizer() + "section: " + sec); CAGE_THROW_ERROR(Exception, "duplicate section"); } continue; @@ -385,7 +385,7 @@ namespace cage itemName = Stringizer() + itemIndex++; if (itemExists(sec, itemName)) { - CAGE_LOG_THROW(Stringizer() + "section: '" + sec + "', item: '" + itemName + "'"); + CAGE_LOG_THROW(Stringizer() + "section: " + sec + ", item: " + itemName); CAGE_THROW_ERROR(Exception, "duplicate item name"); } set(sec, itemName, itemValue); @@ -402,7 +402,7 @@ namespace cage } catch (...) { - CAGE_LOG_THROW(Stringizer() + "failed to load ini file: '" + filename + "'"); + CAGE_LOG_THROW(Stringizer() + "failed to load ini file: " + filename); throw; } } diff --git a/sources/libcore/mesh/importAssimp.cpp b/sources/libcore/mesh/importAssimp.cpp index c9bbf0bb..c415d55f 100644 --- a/sources/libcore/mesh/importAssimp.cpp +++ b/sources/libcore/mesh/importAssimp.cpp @@ -346,7 +346,7 @@ namespace cage if (names.count(n->mName)) { // make the name unique n->mName = String(Stringizer() + n->mName.C_Str() + "_" + n).c_str(); - CAGE_LOG_DEBUG(SeverityEnum::Warning, "assimp", Stringizer() + "renamed a node: '" + n->mName.C_Str() + "'"); + CAGE_LOG_DEBUG(SeverityEnum::Warning, "assimp", Stringizer() + "renamed a node: " + n->mName.C_Str()); } names[n->mName] = n; } @@ -514,7 +514,7 @@ namespace cage contains += "uvs "; if (am->HasVertexColors(0)) contains += "colors "; - CAGE_LOG_CONTINUE(SeverityEnum::Note, "meshImport", Stringizer() + "index: " + i + ", object: '" + objname + "', material: '" + matname + "', contains: " + contains); + CAGE_LOG_CONTINUE(SeverityEnum::Note, "meshImport", Stringizer() + "index: " + i + ", object: " + objname + ", material: " + matname + ", contains: " + contains); } // print animations @@ -522,7 +522,7 @@ namespace cage for (uint32 i = 0; i < scene->mNumAnimations; i++) { const aiAnimation *ani = scene->mAnimations[i]; - CAGE_LOG_CONTINUE(SeverityEnum::Info, "meshImport", Stringizer() + "index: " + i + ", animation: '" + convStrTruncate(ani->mName) + "', channels: " + ani->mNumChannels); + CAGE_LOG_CONTINUE(SeverityEnum::Info, "meshImport", Stringizer() + "index: " + i + ", animation: " + convStrTruncate(ani->mName) + ", channels: " + ani->mNumChannels); } } @@ -614,7 +614,7 @@ namespace cage uint16 idx = skeleton->index(n->mNodeName); if (idx == m) { - CAGE_LOG(SeverityEnum::Warning, "meshImport", Stringizer() + "channel index: " + channelIndex + ", name: '" + n->mNodeName.data + "', has no corresponding bone and will be ignored"); + CAGE_LOG(SeverityEnum::Warning, "meshImport", Stringizer() + "channel index: " + channelIndex + ", name: " + n->mNodeName.data + ", has no corresponding bone and will be ignored"); continue; } boneIndices.push_back(idx); diff --git a/sources/libcore/string.cpp b/sources/libcore/string.cpp index 8322da72..0c4c4aae 100644 --- a/sources/libcore/string.cpp +++ b/sources/libcore/string.cpp @@ -81,7 +81,7 @@ namespace cage } if (!*s || !e || *e != 0 || std::isspace(*s) || errno != 0) { - CAGE_LOG_THROW(Stringizer() + "input string: '" + s + "'"); + CAGE_LOG_THROW(Stringizer() + "input string: " + s); CAGE_THROW_ERROR(Exception, "fromString failed"); } } @@ -94,7 +94,7 @@ namespace cage value = std::strtoll(s, &e, 10); if (!*s || !e || *e != 0 || std::isspace(*s) || errno != 0) { - CAGE_LOG_THROW(Stringizer() + "input string: '" + s + "'"); + CAGE_LOG_THROW(Stringizer() + "input string: " + s); CAGE_THROW_ERROR(Exception, "fromString failed"); } } @@ -107,7 +107,7 @@ namespace cage value = std::strtoull(s, &e, 10); if (!*s || !e || *s == '-' || *e != 0 || std::isspace(*s) || errno != 0) { - CAGE_LOG_THROW(Stringizer() + "input string: '" + s + "'"); + CAGE_LOG_THROW(Stringizer() + "input string: " + s); CAGE_THROW_ERROR(Exception, "fromString failed"); } } @@ -120,7 +120,7 @@ namespace cage double v = std::strtod(s, &e); if (!*s || !e || *e != 0 || std::isspace(*s) || errno != 0) { - CAGE_LOG_THROW(Stringizer() + "input string: '" + s + "'"); + CAGE_LOG_THROW(Stringizer() + "input string: " + s); CAGE_THROW_ERROR(Exception, "fromString failed"); } value = v; @@ -133,7 +133,7 @@ namespace cage genericScan(s, v); if (v < std::numeric_limits::lowest() || v > std::numeric_limits::max()) { - CAGE_LOG_THROW(Stringizer() + "input string: '" + s + "'"); + CAGE_LOG_THROW(Stringizer() + "input string: " + s); CAGE_THROW_ERROR(Exception, "fromString failed"); } value = (float)v; @@ -279,7 +279,7 @@ namespace cage const auto [p, ec] = std::from_chars(s, s + n, value); \ if (p != s + n || ec != std::errc()) \ { \ - CAGE_LOG_THROW(Stringizer() + "input string: '" + s + "'"); \ + CAGE_LOG_THROW(Stringizer() + "input string: " + s); \ CAGE_THROW_ERROR(Exception, "failed conversion of string to " CAGE_STRINGIZE(TYPE)); \ } \ } diff --git a/sources/libengine/virtualReality/controllerBindings.cpp b/sources/libengine/virtualReality/controllerBindings.cpp index 4c1878c0..b92e6c8b 100644 --- a/sources/libengine/virtualReality/controllerBindings.cpp +++ b/sources/libengine/virtualReality/controllerBindings.cpp @@ -123,7 +123,7 @@ namespace cage String section, item, value; if (it.second->anyUnused(section, item, value)) { - CAGE_LOG_THROW(Stringizer() + "section: '" + section + "', item: '" + item + "', " + "value: '" + value + "'"); + CAGE_LOG_THROW(Stringizer() + "section: " + section + ", item: " + item + ", value: " + value); CAGE_LOG_THROW(Stringizer() + "in profile: " + it.first); CAGE_THROW_ERROR(Exception, "unused item in openxr controller bindings configuration"); } diff --git a/sources/libengine/window/gamepad.cpp b/sources/libengine/window/gamepad.cpp index 0fbf50cb..5bbb874e 100644 --- a/sources/libengine/window/gamepad.cpp +++ b/sources/libengine/window/gamepad.cpp @@ -54,7 +54,7 @@ namespace cage d.used[jid] = this; name = glfwGetJoystickName(jid); if (!glfwJoystickIsGamepad(jid)) - CAGE_LOG(SeverityEnum::Warning, "gamepad", Stringizer() + "gamepad '" + name + "' does not have input mapping"); + CAGE_LOG(SeverityEnum::Warning, "gamepad", Stringizer() + "gamepad: " + name + ", does not have input mapping"); processEventsImpl(); } diff --git a/sources/libsimple/fullscreenSwitcher.cpp b/sources/libsimple/fullscreenSwitcher.cpp index 828ba5bf..1fc7f7a9 100644 --- a/sources/libsimple/fullscreenSwitcher.cpp +++ b/sources/libsimple/fullscreenSwitcher.cpp @@ -57,7 +57,7 @@ namespace cage const Vec2i s = Vec2i(confFullscreenWidth, confFullscreenHeight); const uint32 freq = confFullscreenFrequency; const String screen = confScreen; - CAGE_LOG(SeverityEnum::Info, "fullscreenSwitcher", Stringizer() + "setting fullscreen window " + s + " on screen '" + screen + "'"); + CAGE_LOG(SeverityEnum::Info, "fullscreenSwitcher", Stringizer() + "setting fullscreen window: " + s + ", on screen: " + screen); try { detail::OverrideBreakpoint ob; @@ -70,7 +70,7 @@ namespace cage } } - CAGE_LOG(SeverityEnum::Info, "fullscreenSwitcher", Stringizer() + "setting windowed window " + s); + CAGE_LOG(SeverityEnum::Info, "fullscreenSwitcher", Stringizer() + "setting windowed window: " + s); window->setWindowed(); window->windowedPosition(p); window->windowedSize(s); @@ -133,7 +133,7 @@ namespace cage try { const bool r = toBool(trim(String(env))); - CAGE_LOG(SeverityEnum::Warning, "fullscreenSwitcher", Stringizer() + "using environment variable CAGE_FULLSCREEN_DEFAULT, value: " + r); + CAGE_LOG(SeverityEnum::Info, "fullscreenSwitcher", Stringizer() + "using environment variable CAGE_FULLSCREEN_DEFAULT, value: " + r); return r; } catch (const Exception &) diff --git a/sources/mesh-info/main.cpp b/sources/mesh-info/main.cpp index 5605eb60..512921c0 100644 --- a/sources/mesh-info/main.cpp +++ b/sources/mesh-info/main.cpp @@ -10,7 +10,7 @@ using namespace cage; void info(const String &src, int format) { - CAGE_LOG(SeverityEnum::Info, "mesh", Stringizer() + "opening file '" + src + "'"); + CAGE_LOG(SeverityEnum::Info, "mesh", Stringizer() + "opening file: " + src); MeshImportResult msh; try { diff --git a/sources/test-core/files.cpp b/sources/test-core/files.cpp index 487ca710..5b8ad48a 100644 --- a/sources/test-core/files.cpp +++ b/sources/test-core/files.cpp @@ -333,7 +333,7 @@ void testFiles() const String d = "testdir/dangerous/abc'\"^°`_-:?!%;#~(){}[]<>def\7gжяhi.bin"; CAGE_TEST_THROWN(writeFile(d)); const String s = pathReplaceInvalidCharacters(d, "_", true); - CAGE_LOG(SeverityEnum::Info, "tests", Stringizer() + "sanitized path: '" + s + "'"); + CAGE_LOG(SeverityEnum::Info, "tests", Stringizer() + "sanitized path: " + s); CAGE_TEST(writeFile(s)); } diff --git a/sources/test-ginnel/client.cpp b/sources/test-ginnel/client.cpp index 34efa11b..ce76e98c 100644 --- a/sources/test-ginnel/client.cpp +++ b/sources/test-ginnel/client.cpp @@ -11,7 +11,7 @@ void runClient() ConfigString address("address"); ConfigUint32 port("port"); - CAGE_LOG(SeverityEnum::Info, "config", Stringizer() + "address: '" + (String)address + "'"); + CAGE_LOG(SeverityEnum::Info, "config", Stringizer() + "address: " + (String)address); CAGE_LOG(SeverityEnum::Info, "config", Stringizer() + "port: " + (uint32)port); Holder client = newConn(newGinnelConnection(address, port, 0));