Skip to content

Commit

Permalink
logging without '
Browse files Browse the repository at this point in the history
  • Loading branch information
malytomas committed Oct 30, 2024
1 parent eb2140e commit bbe4d43
Show file tree
Hide file tree
Showing 21 changed files with 119 additions and 119 deletions.
8 changes: 4 additions & 4 deletions sources/asset-analyze/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Process> prg = newProcess(String() + "cage-asset-processor analyze " + path);
Expand All @@ -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")
Expand Down Expand Up @@ -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<String> files, directories;
const auto list = pathListDirectory(path);
Expand Down
16 changes: 8 additions & 8 deletions sources/asset-database/databank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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++;
}
}
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -323,7 +323,7 @@ namespace
void findFiles(std::map<String, PathLastChange, StringComparatorFast> &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)
{
Expand Down
20 changes: 10 additions & 10 deletions sources/asset-database/processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
}
}
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -162,8 +162,8 @@ namespace
}

// find new or modified databanks
const auto corruptedDbsCopy = std::move(corruptedDatabanks);
CAGE_ASSERT(corruptedDatabanks.empty());
std::set<String, StringComparatorFast> corruptedDbsCopy;
std::swap(corruptedDbsCopy, corruptedDatabanks);
for (const auto &f : files)
{
if (!isNameDatabank(f.first))
Expand Down Expand Up @@ -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;
}
Expand All @@ -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)
Expand Down Expand Up @@ -254,7 +254,7 @@ void checkAssets()
for (const auto &it : assets)
if (it.second->corrupted)
asses.push_back(+it.second);
tasksRunBlocking<Asset *const>("processing", Delegate<void(Asset *const &)>().bind<&processAsset>(), asses);
tasksRunBlocking<Asset *const>("processing", Delegate<void(Asset *const &)>().bind<processAsset>(), asses);
}

validateAssets();
Expand Down
32 changes: 16 additions & 16 deletions sources/asset-database/scheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -241,79 +241,79 @@ 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;
}
}
else if (type == "sint32")
{
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;
}
}
else if (type == "real")
{
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;
}
}
else if (type == "string")
{
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;
}
}
else if (type == "enum")
{
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;
}
}
Expand All @@ -337,7 +337,7 @@ namespace
continue;
Holder<Scheme> s = systemMemory().createHolder<Scheme>();
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> ini = newIni();
ini->importFile(name);
s->parse(+ini);
Expand Down
2 changes: 1 addition & 1 deletion sources/asset-processor/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}();
Expand Down
12 changes: 6 additions & 6 deletions sources/asset-processor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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");
}
}
Expand All @@ -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();
Expand All @@ -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);
Expand Down
Loading

0 comments on commit bbe4d43

Please sign in to comment.