summaryrefslogtreecommitdiff
path: root/src/resources/attributes.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-07-04 12:13:01 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-07-04 21:17:55 +0200
commit1debcc8032f01dd2bb64f2725143121b57320876 (patch)
tree85cba14f5309a487913c0c430811273343211f8f /src/resources/attributes.cpp
parent3fb53be63095dad2ebcfd52d44f13d20f630e478 (diff)
downloadmana-1debcc8032f01dd2bb64f2725143121b57320876.tar.gz
mana-1debcc8032f01dd2bb64f2725143121b57320876.tar.bz2
mana-1debcc8032f01dd2bb64f2725143121b57320876.tar.xz
mana-1debcc8032f01dd2bb64f2725143121b57320876.zip
Added logging priorities and use SDLs logging facilities
By using SDL logging, we can rely on SDL to filter the log messages by their priority before they get sent to our custom output function. For example, we now no longer get entries for created and destroyed Window instances by default, since these have only "debug" priority whereas the default priority for the "app" category is "info". We can also get log messages raised by SDL itself in our log now. Log levels can be controlled per category through the "SDL_LOGGING" environment variable. Many existing log messages have been assigned a category based on their existing prefix.
Diffstat (limited to 'src/resources/attributes.cpp')
-rw-r--r--src/resources/attributes.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/resources/attributes.cpp b/src/resources/attributes.cpp
index 7ec6b516..5b1018ee 100644
--- a/src/resources/attributes.cpp
+++ b/src/resources/attributes.cpp
@@ -240,22 +240,22 @@ namespace Attributes {
int id = node.getProperty("id", 0);
if (!id)
{
- logger->log("Attributes: Invalid or missing stat ID in "
- DEFAULT_ATTRIBUTESDB_FILE "!");
+ Log::info("Attributes: Invalid or missing stat ID in "
+ DEFAULT_ATTRIBUTESDB_FILE "!");
return;
}
if (attributes.find(id) != attributes.end())
{
- logger->log("Attributes: Redefinition of stat ID %d", id);
+ Log::info("Attributes: Redefinition of stat ID %d", id);
}
std::string name = node.getProperty("name", "");
if (name.empty())
{
- logger->log("Attributes: Invalid or missing stat name in "
- DEFAULT_ATTRIBUTESDB_FILE "!");
+ Log::info("Attributes: Invalid or missing stat name in "
+ DEFAULT_ATTRIBUTESDB_FILE "!");
return;
}
@@ -280,10 +280,10 @@ namespace Attributes {
{
if (name.empty())
{
- logger->log("Attribute modifier in attribute %u:%s: "
- "Empty name definition "
- "on empty tag definition, skipping.",
- a.id, a.name.c_str());
+ Log::info("Attribute modifier in attribute %u:%s: "
+ "Empty name definition "
+ "on empty tag definition, skipping.",
+ a.id, a.name.c_str());
--count;
continue;
}
@@ -296,10 +296,10 @@ namespace Attributes {
{
if (name.empty())
{
- logger->log("Attribute modifier in attribute %u:%s: "
- "Empty name definition "
- "on empty effect definition, skipping.",
- a.id, a.name.c_str());
+ Log::info("Attribute modifier in attribute %u:%s: "
+ "Empty name definition "
+ "on empty effect definition, skipping.",
+ a.id, a.name.c_str());
--count;
continue;
}
@@ -308,7 +308,7 @@ namespace Attributes {
}
tags.insert(std::make_pair(tag, effect));
}
- logger->log("Found %d tags for attribute %d.", count, id);
+ Log::info("Found %d tags for attribute %d.", count, id);
}
/**
@@ -321,8 +321,8 @@ namespace Attributes {
DEFAULT_MIN_PTS);
attributeMaximum = node.getProperty("maximum",
DEFAULT_MAX_PTS);
- logger->log("Loaded points: start: %i, min: %i, max: %i.",
- creationPoints, attributeMinimum, attributeMaximum);
+ Log::info("Loaded points: start: %i, min: %i, max: %i.",
+ creationPoints, attributeMinimum, attributeMaximum);
}
/**
@@ -330,8 +330,8 @@ namespace Attributes {
*/
void checkStatus()
{
- logger->log("Found %d tags for %d attributes.", int(tags.size()),
- int(attributes.size()));
+ Log::info("Found %d tags for %d attributes.", int(tags.size()),
+ int(attributes.size()));
if (attributes.size() == 0)
{
@@ -346,9 +346,9 @@ namespace Attributes {
if (averageValue > attributeMaximum || averageValue < attributeMinimum
|| creationPoints < 1)
{
- logger->log("Attributes: Character's point values make "
- "the character's creation impossible. "
- "Switch back to defaults.");
+ Log::info("Attributes: Character's point values make "
+ "the character's creation impossible. "
+ "Switch back to defaults.");
creationPoints = DEFAULT_POINTS;
attributeMinimum = DEFAULT_MIN_PTS;
attributeMaximum = DEFAULT_MAX_PTS;