Skip to content
1 change: 1 addition & 0 deletions src/esp/core/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ LoggingLevel levelFromName(const Corrade::Containers::StringView name) {
CASE(VeryVerbose, veryverbose);
CASE(Verbose, verbose);
CASE(Debug, debug);
CASE(Default, default);
CASE(Warning, warning);
CASE(Quiet, quiet);
CASE(Error, error);
Expand Down
40 changes: 28 additions & 12 deletions src/esp/core/Logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,43 @@ namespace logging {
* greater than or equal to the logging level within that subsystem, the log
* will be printed.
*
* The convience levels, @ref Verbose and @ref Quiet are the primary user facing
* options. @ref Quiet turns off logging and @ref Verbose is the default and
* shows things that are generally useful. These names exist such that logging
* levels can be added and removed without users needed to change what they set
* logging to.
* The convience levels, @ref Verbose, @ref Default and @ref Quiet are the primary user facing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*convenience

* options. @ref Quiet turns off logging for all but errors, @ref Default is the default and
* shows warnings and errors, while @ref Verbose gives debug messages along with warnings and
* errors. These names exist such that logging levels can be added and removed
* without users needing to change what they set logging to.
*/
enum class LoggingLevel : uint8_t {
/**
* Logging level to be used to provide in depth information about a process
* and its result.
*/
VeryVerbose,

/**
* Logging level to be used to specify the result of some process.
*/
Debug,
/**
* Logging level to be used to denote that some process has yielded a result
* that may not be appropriate or expected.
*/
Warning,
/**
* Logging level to be used to denote that some process has failed.
*/
Error,

/**
* The default logging level. Enables all logging except for the most verbose
* statements. Habitat-Sim will be fairly verbose in this setting, but not
* overly so.
*
* Note: If you add another level that is lower priority than Debug but should
* be on by default or Debug is removed/renamed, this will need to be updated.
* Enables all logging except for the most verbose statements. Habitat-Sim
* will be fairly verbose in this setting, but not overly so.
*/
Verbose = Debug,
/**
* The default logging level. Enables all warning and error messages but hides
* debug and verbose messages.
*/
Default = Warning,
/**
* Turns of all non-critical logging messages, i.e. those that indicate that
* something has gone wrong.
Expand All @@ -165,7 +181,7 @@ LoggingLevel levelFromName(Corrade::Containers::StringView name);
class LoggingContext {
public:
constexpr static const char* LOGGING_ENV_VAR_NAME = "HABITAT_SIM_LOG";
constexpr static LoggingLevel DEFAULT_LEVEL = LoggingLevel::Verbose;
constexpr static LoggingLevel DEFAULT_LEVEL = LoggingLevel::Default;

/**
* @brief Convenience constructor that grabs the configuration string from the
Expand Down
15 changes: 7 additions & 8 deletions src/esp/metadata/attributes/SceneDatasetAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,15 @@ std::pair<std::string, std::string> SceneDatasetAttributes::addNewValToMap(
} while (map.count(newKey) > 0);
ESP_WARNING(Mn::Debug::Flag::NoSpace)
<< descString << " : Provided key '" << key

<< "' already references a different value in "
"map. Modifying key to be"
<< "' already references a different value in map. Modifying key "
"to be '"
<< newKey
<< ". Set overwrite to true to overwrite existing entries.";
<< "'. Set overwrite to true to overwrite existing entries.";
} else { // overwrite entry
ESP_WARNING() << descString
<< ": Warning : Overwriting existing map entry"
<< map.at(newKey) << "at key" << newKey << "with value"
<< path << ".";
ESP_WARNING(Mn::Debug::Flag::NoSpace)
<< descString << " : Overwriting existing map entry "
<< map.at(newKey) << " at key '" << newKey << "' with value'"
<< path << "'.";
} // overwrite or not
} // found entry is desired or not
} // key is found
Expand Down
8 changes: 5 additions & 3 deletions src/esp/metadata/managers/AttributesManagerBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,14 @@ void AttributesManager<T, Access>::buildAttrSrcPathsFromJSONAndLoad(
if (globPaths.size() > 0) {
for (const auto& globPath : globPaths) {
// load all object templates available as configs in absolutePath
ESP_WARNING() << "Glob path result for" << absolutePath << ":"
<< globPath;
ESP_DEBUG() << "<" << this->objectType_ << "> : Glob path result for"
<< absolutePath << ":" << globPath;
this->loadAllTemplatesFromPathAndExt(globPath, extType, true);
}
} else {
ESP_WARNING() << "No Glob path result for" << absolutePath;
ESP_DEBUG(Mn::Debug::Flag::NoSpace)
<< "<" << this->objectType_ << "> : No Glob path result for "
<< absolutePath;
}
}
ESP_DEBUG(Mn::Debug::Flag::NoSpace)
Expand Down
9 changes: 4 additions & 5 deletions src/esp/metadata/managers/SceneDatasetAttributesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void SceneDatasetAttributesManager::setValsFromJSONDoc(
if (jsonConfig.HasMember(tag)) {
namespace Dir = Cr::Utility::Path;
if (!jsonConfig[tag].IsObject()) {
ESP_WARNING()
ESP_DEBUG()
<< "\"" << tag
<< "\" cell in JSON config not appropriately configured. Skipping.";
} else {
Expand Down Expand Up @@ -125,9 +125,8 @@ void SceneDatasetAttributesManager::setValsFromJSONDoc(
for (const auto& globPath : globPaths) {
// load all object templates available as configs in
// absolutePath
ESP_WARNING()
<< "(Articulated Object) : Glob path result for"
<< absolutePath << ":" << globPath;
ESP_DEBUG() << "(Articulated Object) : Glob path result for"
<< absolutePath << ":" << globPath;
// each globPath entry represents real unique entry on disk

//****replaces call to loadAllConfigsFromPath in AOManager
Expand Down Expand Up @@ -307,7 +306,7 @@ void SceneDatasetAttributesManager::readDatasetJSONCell(
} else {
// set attributes as defaultObject_ in attrMgr.
attrMgr->setDefaultObject(attr);
ESP_WARNING(Mn::Debug::Flag::NoSpace)
ESP_DEBUG(Mn::Debug::Flag::NoSpace)
<< "\"" << tag
<< ".default_attributes\" set in Attributes Manager from JSON.";
}
Expand Down
20 changes: 10 additions & 10 deletions src/esp/metadata/managers/SceneInstanceAttributesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ void SceneInstanceAttributesManager::setValsFromJSONDoc(
}
}
} else {
ESP_WARNING() << "No Objects specified for scene" << attribsDispName
<< ", or specification error.";
ESP_DEBUG() << "No Objects specified for scene" << attribsDispName
<< ", or specification error.";
}
}

Expand All @@ -104,8 +104,8 @@ void SceneInstanceAttributesManager::setValsFromJSONDoc(
}
}
} else {
ESP_WARNING() << "No Articulated Objects specified for scene"
<< attribsDispName << ", or specification error.";
ESP_DEBUG() << "No Articulated Objects specified for scene"
<< attribsDispName << ", or specification error.";
}

std::string dfltLighting = "";
Expand All @@ -114,8 +114,8 @@ void SceneInstanceAttributesManager::setValsFromJSONDoc(
// if "default lighting" is specified in scene json set value.
attribs->setLightingHandle(dfltLighting);
} else {
ESP_WARNING() << "No default_lighting specified for scene"
<< attribsDispName << ".";
ESP_DEBUG() << "No default_lighting specified for scene" << attribsDispName
<< ".";
}

std::string navmeshName = "";
Expand All @@ -124,8 +124,8 @@ void SceneInstanceAttributesManager::setValsFromJSONDoc(
// if "navmesh_instance" is specified in scene json set value.
attribs->setNavmeshHandle(navmeshName);
} else {
ESP_WARNING() << "No navmesh_instance specified for scene"
<< attribsDispName << ".";
ESP_DEBUG() << "No navmesh_instance specified for scene" << attribsDispName
<< ".";
}

std::string semanticDesc = "";
Expand All @@ -134,8 +134,8 @@ void SceneInstanceAttributesManager::setValsFromJSONDoc(
// if "semantic scene instance" is specified in scene json set value.
attribs->setSemanticSceneHandle(semanticDesc);
} else {
ESP_WARNING() << "No semantic_scene_instance specified for scene"
<< attribsDispName << ".";
ESP_DEBUG() << "No semantic_scene_instance specified for scene"
<< attribsDispName << ".";
}
// check for user defined attributes
this->parseUserDefinedJsonVals(attribs, jsonConfig);
Expand Down
4 changes: 2 additions & 2 deletions src/esp/physics/PhysicsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ int PhysicsManager::addObject(
std::string simpleObjectHandle = objectAttributes->getSimplifiedHandle();
std::string newObjectHandle =
rigidObjectManager_->getUniqueHandleFromCandidate(simpleObjectHandle);
ESP_WARNING() << "Simplified template handle :" << simpleObjectHandle
<< " | newObjectHandle :" << newObjectHandle;
ESP_DEBUG() << "Simplified template handle :" << simpleObjectHandle
<< " | newObjectHandle :" << newObjectHandle;

existingObjects_.at(nextObjectID_)->setObjectName(newObjectHandle);

Expand Down
36 changes: 23 additions & 13 deletions src/esp/sim/Simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,21 +247,31 @@ bool Simulator::createSceneInstance(const std::string& activeSceneName) {
activeSceneName));

// 2. Load navmesh specified in current scene instance attributes.
const std::string& navmeshFileLoc = metadataMediator_->getNavmeshPathByHandle(
curSceneInstanceAttributes_->getNavmeshHandle());

ESP_DEBUG() << "Navmesh file location in scene instance :" << navmeshFileLoc;
// Get name of navmesh and use to create pathfinder and load navmesh
const std::string& navmeshFileHandle =
curSceneInstanceAttributes_->getNavmeshHandle();
// create pathfinder and load navmesh if available
pathfinder_ = nav::PathFinder::create();
if (Cr::Utility::Path::exists(navmeshFileLoc)) {
ESP_DEBUG() << "Loading navmesh from" << navmeshFileLoc;
bool pfSuccess = pathfinder_->loadNavMesh(navmeshFileLoc);
ESP_DEBUG() << (pfSuccess ? "Navmesh Loaded." : "Navmesh load error.");
if (navmeshFileHandle.empty()) {
ESP_DEBUG() << "No navmesh file handle provided in scene instance.";

} else {
ESP_WARNING(Mn::Debug::Flag::NoSpace)
<< "Navmesh file not found, checked at filename : '" << navmeshFileLoc
<< "'";
const std::string& navmeshFileLoc =
metadataMediator_->getNavmeshPathByHandle(navmeshFileHandle);
// Get name of navmesh and use to create pathfinder and load navmesh
if (navmeshFileLoc.empty()) {
ESP_DEBUG() << "No navmesh file location provided in scene dataset that "
"maps to handle :"
<< navmeshFileHandle;
} else if (Cr::Utility::Path::exists(navmeshFileLoc)) {
ESP_DEBUG() << "Loading navmesh from" << navmeshFileLoc;
bool pfSuccess = pathfinder_->loadNavMesh(navmeshFileLoc);
ESP_DEBUG() << (pfSuccess ? "Navmesh Loaded." : "Navmesh load error.");
} else {
ESP_WARNING(Mn::Debug::Flag::NoSpace)
<< "Navmesh file not found, checked at filename : '" << navmeshFileLoc
<< "'";
}
}
// Calling to seeding needs to be done after the pathfinder creation but
// before anything else.
Expand Down Expand Up @@ -493,9 +503,9 @@ bool Simulator::instanceStageForSceneAttributes(
semanticSceneMeshLoaded_ = false;
// TODO: programmatic generation of semantic meshes when no
// annotations are provided.
ESP_WARNING() << "\n---\nThe active scene does not contain semantic "
ESP_WARNING() << "The active scene does not contain semantic "
"annotations : activeSemanticSceneID_ ="
<< activeSemanticSceneID_ << " \n---";
<< activeSemanticSceneID_;
}
}
} // if ID has changed - needs to be reset
Expand Down
2 changes: 1 addition & 1 deletion src/tests/LoggingTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ constexpr const struct {
const char* gfxDebug;
const char* gfxWarning;
} EnvVarTestData[]{
{nullptr, "[Default] LoggingTest.cpp(103)::envVarTest : DebugDefault\n",
{"verbose", "[Default] LoggingTest.cpp(103)::envVarTest : DebugDefault\n",
"[Default] LoggingTest.cpp(107)::envVarTest : WarningDefault\n",
"[Sim] LoggingTest.cpp(23)::debug : DebugSim\n",
"[Sim] LoggingTest.cpp(26)::warning : WarningSim\n",
Expand Down