diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 42100b12a4..a1f0df4617 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include @@ -104,7 +104,7 @@ LONG WINAPI generateMiniDump(EXCEPTION_POINTERS* exceptionPointers) { GetCurrentThreadId() ); - LINFO("Creating dump file: " << dumpFile); + LINFO(fmt::format("Creating dump file: {}", dumpFile)); HANDLE hDumpFile = CreateFile( dumpFile.c_str(), @@ -320,13 +320,10 @@ void mainInitFunc() { char mbstr[100]; strftime(mbstr, sizeof(mbstr), "%Y-%m-%d-%H-%M", nowTime); screenshotPath += "/" + std::string(mbstr); - - std::string p = absPath(screenshotPath); - if (!FileSys.directoryExists(p)) { - FileSys.createDirectory(p); - } } + FileSys.registerPathToken("${THIS_SCREENSHOT_PATH}", screenshotPath); + for (size_t i = 0; i < nWindows; ++i) { sgct_core::ScreenCapture* cpt0 = SgctEngine->getWindowPtr(i)->getScreenCapturePointer(0); @@ -559,7 +556,9 @@ int main_main(int argc, char** argv) { catch (const ghoul::RuntimeError& e) { // Write out all of the information about the exception and flush the logs LFATALC(e.component, e.message); - LogMgr.flushLogs(); + if (ghoul::logging::LogManager::isInitialized()) { + LogMgr.flushLogs(); + } return EXIT_FAILURE; } catch (const ghoul::AssertionException& e) { @@ -570,12 +569,16 @@ int main_main(int argc, char** argv) { } catch (const std::exception& e) { LFATALC("Exception", e.what()); - LogMgr.flushLogs(); + if (ghoul::logging::LogManager::isInitialized()) { + LogMgr.flushLogs(); + } return EXIT_FAILURE; } catch (...) { LFATALC("Exception", "Unknown exception"); - LogMgr.flushLogs(); + if (ghoul::logging::LogManager::isInitialized()) { + LogMgr.flushLogs(); + } return EXIT_FAILURE; } @@ -583,7 +586,9 @@ int main_main(int argc, char** argv) { return EXIT_SUCCESS; } - LINFO("Detected OpenGL version: " << glVersion.first << "." << glVersion.second); + LINFO(fmt::format( + "Detected OpenGL version: {}.{}", glVersion.first, glVersion.second + )); // Create sgct engine c arguments int newArgc = static_cast(sgctArguments.size()); diff --git a/apps/Sync/main.cpp b/apps/Sync/main.cpp index 86bee06c87..22ecaa259f 100644 --- a/apps/Sync/main.cpp +++ b/apps/Sync/main.cpp @@ -52,8 +52,11 @@ int main(int argc, char** argv) { Task& task = *tasks[i].get(); LINFOC( "Sync", - "Synchronizing scene " << (i + 1) << " out of " << - tasks.size() << ": " << task.description() + fmt::format( + "Synchronizing scene {} out of {}: {}", + i + 1, tasks.size(), + task.description() + ) ); ProgressBar progressBar(100); task.perform([&progressBar](float progress) { diff --git a/apps/TaskRunner/main.cpp b/apps/TaskRunner/main.cpp index 7f6ffe0157..85a206d436 100644 --- a/apps/TaskRunner/main.cpp +++ b/apps/TaskRunner/main.cpp @@ -83,15 +83,14 @@ void performTasks(const std::string& path) { LINFO("Task queue has 1 item"); } else { - LINFO("Task queue has " << tasks.size() << " items"); + LINFO(fmt::format("Task queue has {} items", tasks.size())); } for (size_t i = 0; i < tasks.size(); i++) { Task& task = *tasks[i].get(); - LINFO( - "Performing task " << (i + 1) << " out of " << - tasks.size() << ": " << task.description() - ); + LINFO(fmt::format( + "Performing task {} out of {}: {}", i + 1, tasks.size(), task.description() + )); ProgressBar progressBar(100); auto onProgress = [&progressBar](float progress) { progressBar.print(static_cast(progress * 100.f)); @@ -135,7 +134,7 @@ int main(int argc, char** argv) { // If no task file was specified in as argument, run in CLI mode. - LINFO("Task root: " << absPath("${TASKS}")); + LINFO(fmt::format("Task root: {}", absPath("${TASKS}"))); FileSys.setCurrentDirectory(ghoul::filesystem::Directory(absPath("${TASKS}"))); std::cout << "TASK > "; diff --git a/data/assets/customization/globebrowsing.asset b/data/assets/customization/globebrowsing.asset index 105a2b18b0..751b4faa21 100644 --- a/data/assets/customization/globebrowsing.asset +++ b/data/assets/customization/globebrowsing.asset @@ -16,8 +16,8 @@ local vrt_folders = { -- -- tl;dr: Specify CTX folders first, then HiRISE -- example: 'C:/OpenSpace/GlobeBrowsingData/Mars/CTX' - '', - '' + 'C:/ab7512/OpenSpaceData/Mars/CTX', + 'C:/ab7512/OpenSpaceData/Mars/HiRISE', }, Moon = { -- Add folders here whose contents will be automatically added to the Moon globe @@ -25,8 +25,7 @@ local vrt_folders = { -- if areas overlap, images from the lower results will overwrite the images from former -- results -- example: 'C:/OpenSpace/GlobeBrowsingData/Moon' - '', - '' + 'C:/ab7512/OpenSpaceData/Moon' } } diff --git a/data/assets/default.scene b/data/assets/default.scene index af3d3ae439..b32bf5da5c 100644 --- a/data/assets/default.scene +++ b/data/assets/default.scene @@ -49,7 +49,7 @@ local Keybindings = { }, { Key = "h", - Command = "openspace.setPropertyValue('*Trail.renderable.Enabled', false)", + Command = "openspace.setPropertyValue('Scene.*Trail.renderable.Enabled', false)", Documentation = "Disables visibility of the trails", Local = false }, @@ -76,7 +76,7 @@ asset.onInitialize(function () openspace.addVirtualProperty( "BoolProperty", "Show Trails", - "*Trail.renderable.Enabled", + "Scene.*Trail.renderable.Enabled", "Disable or enable all trails of the scene at the same time", true, nil, diff --git a/data/assets/scene/solarsystem/planets/earth/map_service_configs/ESRI/World_Imagery.wms b/data/assets/scene/solarsystem/planets/earth/map_service_configs/ESRI/World_Imagery.wms index f7021fd20f..3e4b4d170d 100644 --- a/data/assets/scene/solarsystem/planets/earth/map_service_configs/ESRI/World_Imagery.wms +++ b/data/assets/scene/solarsystem/planets/earth/map_service_configs/ESRI/World_Imagery.wms @@ -20,3 +20,7 @@ false 5 + + + 1073741824 + \ No newline at end of file diff --git a/ext/ghoul b/ext/ghoul index 94d740353e..e77207ae0e 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 94d740353ecfee60fc64d9364831bef7c92f4066 +Subproject commit e77207ae0ecca9f621c42dac08191246b6b80172 diff --git a/include/openspace/properties/templateproperty.inl b/include/openspace/properties/templateproperty.inl index 3da6579016..fc9f6c59ca 100644 --- a/include/openspace/properties/templateproperty.inl +++ b/include/openspace/properties/templateproperty.inl @@ -23,6 +23,7 @@ ****************************************************************************************/ #include +#include namespace openspace::properties { @@ -202,8 +203,14 @@ void TemplateProperty::set(ghoul::any value) { } } catch (ghoul::bad_any_cast&) { - LERRORC("TemplateProperty", "Illegal cast from '" << value.type().name() - << "' to '" << typeid(T).name() << "'"); + LERRORC( + "TemplateProperty", + fmt::format( + "Illegal cast from '{}' to '{}'", + value.type().name(), + typeid(T).name() + ) + ); } } diff --git a/modules/atmosphere/rendering/renderableatmosphere.cpp b/modules/atmosphere/rendering/renderableatmosphere.cpp index 90579fb98a..ee67e21e41 100644 --- a/modules/atmosphere/rendering/renderableatmosphere.cpp +++ b/modules/atmosphere/rendering/renderableatmosphere.cpp @@ -331,9 +331,12 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) sourceArray.emplace_back(sourceName, sourceRadius); } else { - LWARNING("No Radius value expecified for Shadow Source Name " - << sourceName << " from " << name - << " planet.\nDisabling shadows for this planet."); + LWARNING(fmt::format( + "No Radius value expecified for Shadow Source Name '{}' from " + "'{}' planet. Disabling shadows for this planet.", + sourceName, + name + )); disableShadows = true; break; } @@ -357,9 +360,12 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) casterArray.emplace_back(casterName, casterRadius); } else { - LWARNING("No Radius value expecified for Shadow Caster Name " - << casterName << " from " << name - << " planet.\nDisabling shadows for this planet."); + LWARNING(fmt::format( + "No Radius value expecified for Shadow Caster Name '{}' from " + "'{}' planet. Disabling shadows for this planet.", + casterName, + name + )); disableShadows = true; break; } @@ -391,14 +397,20 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) if (success) { if (!atmosphereDictionary.getValue(keyAtmosphereRadius, _atmosphereRadius)) { errorReadingAtmosphereData = true; - LWARNING("No Atmosphere Radius value expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet."); + LWARNINGC( + name, + "No Atmosphere Radius value specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." + ); } if (!atmosphereDictionary.getValue(keyPlanetRadius, _atmospherePlanetRadius)) { errorReadingAtmosphereData = true; - LWARNING("No Planet Radius value expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet."); + LWARNINGC( + name, + "No Planet Radius value expecified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." + ); } if (!atmosphereDictionary.getValue( @@ -406,10 +418,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) _planetAverageGroundReflectance)) { errorReadingAtmosphereData = true; - LWARNING( - "No Average Atmosphere Ground Reflectance value expecified for " - "Atmosphere Effects of " << name << " planet.\nDisabling atmosphere " - "effects for this planet." + LWARNINGC( + name, + "No Average Atmosphere Ground Reflectance value specified for " + "Atmosphere Effects. Disabling atmosphere effects for this planet." ); } @@ -418,10 +430,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) _planetGroundRadianceEmittion)) { errorReadingAtmosphereData = true; - LWARNING( - "No Ground Radiance Emitted percentage value expecified for Atmosphere " - "Effects of " << name << " planet.\nDisabling atmosphere effects for " - "this planet." + LWARNINGC( + name, + "No Ground Radiance Emitted percentage value specified for Atmosphere " + "Effects. Disabling atmosphere effects for this planet." ); } @@ -441,10 +453,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) _rayleighScatteringCoeff)) { errorReadingAtmosphereData = true; - LWARNING( - "No Rayleigh Scattering parameters expecified for Atmosphere Effects " - "of " << name << " planet.\nDisabling atmosphere effects for this " - "planet." + LWARNINGC( + name, + "No Rayleigh Scattering parameters specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." ); } @@ -453,16 +465,20 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) _rayleighHeightScale)) { errorReadingAtmosphereData = true; - LWARNING( - "No Rayleigh Height Scale value expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet." + LWARNINGC( + name, + "No Rayleigh Height Scale value specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." ); } } else { errorReadingAtmosphereData = true; - LWARNING("No Rayleigh parameters expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet."); + LWARNINGC( + name, + "No Rayleigh parameters specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." + ); } ghoul::Dictionary ozoneDictionary; @@ -489,41 +505,46 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) if (success) { if (!mieDictionary.getValue(keyMieHeightScale, _mieHeightScale)) { errorReadingAtmosphereData = true; - LWARNING( - "No Mie Height Scale value expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet." + LWARNINGC( + name, + "No Mie Height Scale value specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." ); } if (!mieDictionary.getValue("Coefficients.Scattering", _mieScatteringCoeff)) { errorReadingAtmosphereData = true; - LWARNING( - "No Mie Scattering parameters expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet." + LWARNINGC( + name, + "No Mie Scattering parameters specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." ); } if (!mieDictionary.getValue("Coefficients.Extinction", _mieExtinctionCoeff)) { errorReadingAtmosphereData = true; - LWARNING( - "No Mie Extinction parameters expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet." + LWARNINGC( + name, + "No Mie Extinction parameters specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." ); } if (!mieDictionary.getValue(keyMiePhaseConstant, _miePhaseConstant)) { errorReadingAtmosphereData = true; - LWARNING( - "No Mie Phase Constant value expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet." + LWARNINGC( + name, + "No Mie Phase Constant value specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." ); } } else { errorReadingAtmosphereData = true; - LWARNING( - "No Mie parameters expecified for Atmosphere Effects of " - << name << " planet.\nDisabling atmosphere effects for this planet." + LWARNINGC( + name, + "No Mie parameters specified for Atmosphere Effects. " + "Disabling atmosphere effects for this planet." ); } @@ -531,7 +552,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) success = atmosphereDictionary.getValue(keyImage, ImageDictionary); if (success) { if (ImageDictionary.getValue(keyToneMappingOp, _preCalculatedTexturesScale)) { - LDEBUG("Atmosphere Texture Scaled to " << _preCalculatedTexturesScale); + LDEBUG(fmt::format( + "Atmosphere Texture Scaled to {}", + _preCalculatedTexturesScale + )); } } @@ -539,7 +563,10 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary) success = atmosphereDictionary.getValue(keyATMDebug, debugDictionary); if (success) { if (debugDictionary.getValue(keyTextureScale, _preCalculatedTexturesScale)) { - LDEBUG("Atmosphere Texture Scaled to " << _preCalculatedTexturesScale); + LDEBUG(fmt::format( + "Atmosphere Texture Scaled to {}", + _preCalculatedTexturesScale + )); } if (debugDictionary.getValue(keySaveTextures, _saveCalculationsToTexture)) { diff --git a/modules/base/basemodule.cpp b/modules/base/basemodule.cpp index 59b4ce4d86..2d39afc6bf 100644 --- a/modules/base/basemodule.cpp +++ b/modules/base/basemodule.cpp @@ -64,8 +64,6 @@ #include #include -#include - namespace openspace { BaseModule::BaseModule() : OpenSpaceModule(BaseModule::Name) {} diff --git a/modules/base/dashboard/dashboarditemangle.cpp b/modules/base/dashboard/dashboarditemangle.cpp index c850d050b7..517d5b8aa5 100644 --- a/modules/base/dashboard/dashboarditemangle.cpp +++ b/modules/base/dashboard/dashboarditemangle.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include diff --git a/modules/base/dashboard/dashboarditemdate.cpp b/modules/base/dashboard/dashboarditemdate.cpp index b9cfe90f32..16401ec100 100644 --- a/modules/base/dashboard/dashboarditemdate.cpp +++ b/modules/base/dashboard/dashboarditemdate.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/modules/base/dashboard/dashboarditemdistance.cpp b/modules/base/dashboard/dashboarditemdistance.cpp index 2ca2cf17ce..bba284a572 100644 --- a/modules/base/dashboard/dashboarditemdistance.cpp +++ b/modules/base/dashboard/dashboarditemdistance.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include diff --git a/modules/base/dashboard/dashboarditemframerate.cpp b/modules/base/dashboard/dashboarditemframerate.cpp index f1ffe46805..0bf6238a6b 100644 --- a/modules/base/dashboard/dashboarditemframerate.cpp +++ b/modules/base/dashboard/dashboarditemframerate.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/modules/base/dashboard/dashboarditemmission.cpp b/modules/base/dashboard/dashboarditemmission.cpp index 57a0a47e7a..331e3c92d9 100644 --- a/modules/base/dashboard/dashboarditemmission.cpp +++ b/modules/base/dashboard/dashboarditemmission.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include diff --git a/modules/base/dashboard/dashboarditemparallelconnection.cpp b/modules/base/dashboard/dashboarditemparallelconnection.cpp index 9053f659ec..b15025ce52 100644 --- a/modules/base/dashboard/dashboarditemparallelconnection.cpp +++ b/modules/base/dashboard/dashboarditemparallelconnection.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include diff --git a/modules/base/dashboard/dashboarditemsimulationincrement.cpp b/modules/base/dashboard/dashboarditemsimulationincrement.cpp index 0e56cadb3a..e916b12484 100644 --- a/modules/base/dashboard/dashboarditemsimulationincrement.cpp +++ b/modules/base/dashboard/dashboarditemsimulationincrement.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include diff --git a/modules/base/rendering/modelgeometry.cpp b/modules/base/rendering/modelgeometry.cpp index 0ba95c2e7c..1ca0f16d75 100644 --- a/modules/base/rendering/modelgeometry.cpp +++ b/modules/base/rendering/modelgeometry.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -208,7 +209,11 @@ bool ModelGeometry::loadObj(const std::string& filename) { const bool hasCachedFile = FileSys.fileExists(cachedFile); if (hasCachedFile) { - LINFO("Cached file '" << cachedFile << "' used for file '" << filename << "'"); + LINFO(fmt::format( + "Cached file '{}' used for file '{}", + cachedFile, + filename + )); const bool success = loadCachedFile(cachedFile); if (success) { @@ -221,12 +226,14 @@ bool ModelGeometry::loadObj(const std::string& filename) { // file for the next run } else { - LINFO( - "Cached file '" << cachedFile << "' for file '" << filename << "' not found" - ); + LINFO(fmt::format( + "Cached file '{}' for file '{}' not found", + cachedFile, + filename + )); } - LINFO("Loading Model file '" << filename << "'"); + LINFO(fmt::format("Loading Model file '{}'", filename)); const bool modelSuccess = loadModel(filename); if (!modelSuccess) { @@ -262,7 +269,7 @@ bool ModelGeometry::saveCachedFile(const std::string& filename) { return fileStream.good(); } else { - LERROR("Error opening file '" << filename << "' for save cache file"); + LERROR(fmt::format("Error opening file '{}' for save cache file", filename)); return false; } } @@ -284,7 +291,10 @@ bool ModelGeometry::loadCachedFile(const std::string& filename) { fileStream.read(reinterpret_cast(&iSize), sizeof(int64_t)); if (vSize == 0 || iSize == 0) { - LERROR("Error opening file '" << filename << "' for loading cache file"); + LERROR(fmt::format( + "Error opening file '{}' for loading cache file", + filename + )); return false; } @@ -300,7 +310,10 @@ bool ModelGeometry::loadCachedFile(const std::string& filename) { return fileStream.good(); } else { - LERROR("Error opening file '" << filename << "' for loading cache file"); + LERROR(fmt::format( + "Error opening file '{}' for loading cache file", + filename + )); return false; } } diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index 9f94d6a74f..7a335522ab 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -273,7 +273,7 @@ void RenderableModel::loadTexture() { if (_texture) { LDEBUGC( "RenderableModel", - "Loaded texture from '" << absPath(_colorTexturePath) << "'" + fmt::format("Loaded texture from '{}'", absPath(_colorTexturePath)) ); _texture->uploadTexture(); _texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap); diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp index ebbdbfdc18..071f813366 100644 --- a/modules/base/rendering/renderableplane.cpp +++ b/modules/base/rendering/renderableplane.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include diff --git a/modules/base/rendering/renderableplaneimagelocal.cpp b/modules/base/rendering/renderableplaneimagelocal.cpp index 493cb2bd86..650ad3a3f7 100644 --- a/modules/base/rendering/renderableplaneimagelocal.cpp +++ b/modules/base/rendering/renderableplaneimagelocal.cpp @@ -118,7 +118,7 @@ void RenderablePlaneImageLocal::loadTexture() { if (texture) { LDEBUGC( "RenderablePlane", - "Loaded texture from '" << absPath(_texturePath) << "'" + fmt::format("Loaded texture from '{}'", absPath(_texturePath)) ); texture->uploadTexture(); diff --git a/modules/base/rendering/renderableplaneimageonline.cpp b/modules/base/rendering/renderableplaneimageonline.cpp index da432e7f13..3202c4410e 100644 --- a/modules/base/rendering/renderableplaneimageonline.cpp +++ b/modules/base/rendering/renderableplaneimageonline.cpp @@ -117,7 +117,7 @@ void RenderablePlaneImageOnline::update(const UpdateData&) { if (imageFile.corrupted) { LERRORC( "ScreenSpaceImageOnline", - "Error loading image from URL '" << _texturePath << "'" + fmt::format("Error loading image from URL '{}'", _texturePath) ); return; } diff --git a/modules/base/rendering/renderablesphere.cpp b/modules/base/rendering/renderablesphere.cpp index 1b56dea202..7fc9911301 100644 --- a/modules/base/rendering/renderablesphere.cpp +++ b/modules/base/rendering/renderablesphere.cpp @@ -386,7 +386,7 @@ void RenderableSphere::loadTexture() { if (texture) { LDEBUGC( "RenderableSphere", - "Loaded texture from '" << absPath(_texturePath) << "'" + fmt::format("Loaded texture from '{}'", absPath(_texturePath)) ); texture->uploadTexture(); diff --git a/modules/base/rendering/screenspaceimagelocal.cpp b/modules/base/rendering/screenspaceimagelocal.cpp index 51e16c399a..c8e040ce1a 100644 --- a/modules/base/rendering/screenspaceimagelocal.cpp +++ b/modules/base/rendering/screenspaceimagelocal.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include namespace { diff --git a/modules/base/rendering/screenspaceimageonline.cpp b/modules/base/rendering/screenspaceimageonline.cpp index 0bc089b7e6..cad4a48541 100644 --- a/modules/base/rendering/screenspaceimageonline.cpp +++ b/modules/base/rendering/screenspaceimageonline.cpp @@ -31,9 +31,9 @@ #include #include -#include +#include #include -#include +#include namespace { constexpr const char* KeyName = "Name"; @@ -124,7 +124,7 @@ void ScreenSpaceImageOnline::update() { if (imageFile.corrupted) { LERRORC( "ScreenSpaceImageOnline", - "Error loading image from URL '" << _texturePath << "'" + fmt::format("Error loading image from URL '{}'", _texturePath) ); return; } diff --git a/modules/base/rotation/fixedrotation.cpp b/modules/base/rotation/fixedrotation.cpp index 8167eb86ed..fdcb009971 100644 --- a/modules/base/rotation/fixedrotation.cpp +++ b/modules/base/rotation/fixedrotation.cpp @@ -29,6 +29,7 @@ #include #include +#include #include namespace { @@ -550,8 +551,11 @@ glm::dmat3 FixedRotation::matrix(const Time&) const { { LWARNINGC( "FixedRotation", - "Dangerously collinear vectors detected: " << - "x: " << x << " y: " << y << " z: " << z + fmt::format("Dangerously collinear vectors detected: x ({}) y ({}) z ({})", + x, + y, + z + ) ); return glm::dmat3(); } diff --git a/modules/base/rotation/luarotation.cpp b/modules/base/rotation/luarotation.cpp index c900f0515d..5f46aa466e 100644 --- a/modules/base/rotation/luarotation.cpp +++ b/modules/base/rotation/luarotation.cpp @@ -105,7 +105,7 @@ glm::dmat3 LuaRotation::matrix(const Time& time) const { if (!isFunction) { LERRORC( "LuaRotation", - "Script '" << _luaScriptFile << "' does not have a function 'rotation'" + fmt::format("Script '{}' does nto have a function 'rotation'", _luaScriptFile) ); return glm::dmat3(1.0); } @@ -128,7 +128,7 @@ glm::dmat3 LuaRotation::matrix(const Time& time) const { if (success != 0) { LERRORC( "LuaScale", - "Error executing 'rotation': " << lua_tostring(_state, -1) + fmt::format("Error executing 'rotation': {}", lua_tostring(_state, -1)) ); } diff --git a/modules/base/scale/luascale.cpp b/modules/base/scale/luascale.cpp index 19baa0114a..12d919ee4f 100644 --- a/modules/base/scale/luascale.cpp +++ b/modules/base/scale/luascale.cpp @@ -96,7 +96,7 @@ double LuaScale::scaleValue(const Time& time) const { if (!isFunction) { LERRORC( "LuaScale", - "Script '" << _luaScriptFile << "' does not have a function 'scale'" + fmt::format("Script '{}' does not have a function 'scale'", _luaScriptFile) ); return 0.0; } @@ -119,7 +119,7 @@ double LuaScale::scaleValue(const Time& time) const { if (success != 0) { LERRORC( "LuaScale", - "Error executing 'scale': " << lua_tostring(_state, -1) + fmt::format("Error executing 'scale': {}", lua_tostring(_state, -1)) ); } diff --git a/modules/base/translation/luatranslation.cpp b/modules/base/translation/luatranslation.cpp index 1e619aeef9..d4c60cc7d2 100644 --- a/modules/base/translation/luatranslation.cpp +++ b/modules/base/translation/luatranslation.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -107,7 +108,10 @@ glm::dvec3 LuaTranslation::position(const Time& time) const { if (!isFunction) { LERRORC( "LuaScale", - "Script '" << _luaScriptFile << "' does not have a function 'translation'" + fmt::format( + "Script '{}' does not have a function 'translation'", + _luaScriptFile + ) ); return glm::dvec3(0.0); } @@ -130,7 +134,10 @@ glm::dvec3 LuaTranslation::position(const Time& time) const { if (success != 0) { LERRORC( "LuaScale", - "Error executing 'translation': " << lua_tostring(_state, -1) + fmt::format( + "Error executing 'translation': {}", + lua_tostring(_state, -1) + ) ); } diff --git a/modules/debugging/rendering/renderabledebugplane.cpp b/modules/debugging/rendering/renderabledebugplane.cpp index 71020474c3..f7d884ce1d 100644 --- a/modules/debugging/rendering/renderabledebugplane.cpp +++ b/modules/debugging/rendering/renderabledebugplane.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include diff --git a/modules/digitaluniverse/digitaluniversemodule.cpp b/modules/digitaluniverse/digitaluniversemodule.cpp index 472905b0a3..24b052a374 100644 --- a/modules/digitaluniverse/digitaluniversemodule.cpp +++ b/modules/digitaluniverse/digitaluniversemodule.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include namespace openspace { diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index efa840cffc..d28719d1d0 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -30,7 +30,8 @@ #include #include -#include +#include +#include #include #include #include @@ -807,8 +808,6 @@ void RenderableBillboardsCloud::renderLabels(const RenderData& data, const glm::dvec3& orthoUp, float fadeInVariable) { - RenderEngine& renderEngine = OsEng.renderEngine(); - float scale = 0.0; switch (_unit) { case Meter: @@ -993,11 +992,11 @@ void RenderableBillboardsCloud::update(const UpdateData&) { if (_vao == 0) { glGenVertexArrays(1, &_vao); - LDEBUG("Generating Vertex Array id '" << _vao << "'"); + LDEBUG(fmt::format("Generating Vertex Array id '{}'", _vao)); } if (_vbo == 0) { glGenBuffers(1, &_vbo); - LDEBUG("Generating Vertex Buffer Object id '" << _vbo << "'"); + LDEBUG(fmt::format("Generating Vertex Buffer Object id '{}'", _vbo)); } glBindVertexArray(_vao); @@ -1062,7 +1061,10 @@ void RenderableBillboardsCloud::update(const UpdateData&) { absPath(_spriteTexturePath) ); if (_spriteTexture) { - LINFO("Loaded texture from '" << absPath(_spriteTexturePath) << "'"); + LINFO(fmt::format( + "Loaded texture from '{}'", + absPath(_spriteTexturePath) + )); _spriteTexture->uploadTexture(); } _spriteTexture->setFilter( @@ -1115,10 +1117,11 @@ bool RenderableBillboardsCloud::loadSpeckData() { bool hasCachedFile = FileSys.fileExists(cachedFile); if (hasCachedFile) { - LINFO( - "Cached file '" << cachedFile << "' used for Speck file '" << - _file << "'" - ); + LINFO(fmt::format( + "Cached file '{}' used for Speck file '{}'", + cachedFile, + _file + )); success = loadCachedFile(cachedFile); if (success) { @@ -1131,9 +1134,9 @@ bool RenderableBillboardsCloud::loadSpeckData() { } } else { - LINFO("Cache for Speck file '" << _file << "' not found"); + LINFO(fmt::format("Cache for Speck file '{}' not found", _file)); } - LINFO("Loading Speck file '" << _file << "'"); + LINFO(fmt::format("Loading Speck file '{}'", _file)); success = readSpeckFile(); if (!success) { @@ -1159,10 +1162,11 @@ bool RenderableBillboardsCloud::loadLabelData() { } bool hasCachedFile = FileSys.fileExists(cachedFile); if (hasCachedFile) { - LINFO( - "Cached file '" << cachedFile << "' used for Label file '" << - labelFile << "'" - ); + LINFO(fmt::format( + "Cached file '{}' used for Label file '{}'", + cachedFile, + labelFile + )); success &= loadCachedFile(cachedFile); if (!success) { @@ -1172,8 +1176,8 @@ bool RenderableBillboardsCloud::loadLabelData() { } } else { - LINFO("Cache for Label file '" << labelFile << "' not found"); - LINFO("Loading Label file '" << labelFile << "'"); + LINFO(fmt::format("Cache for Label file '{}' not found", labelFile)); + LINFO(fmt::format("Loading Label file '{}'", labelFile)); success &= readLabelFile(); if (!success) { @@ -1190,7 +1194,7 @@ bool RenderableBillboardsCloud::readSpeckFile() { std::string _file = _speckFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Speck file '" << _file << "'"); + LERROR(fmt::format("Failed to open Speck file '{}'", _file)); return false; } @@ -1280,7 +1284,7 @@ bool RenderableBillboardsCloud::readColorMapFile() { std::string _file = _colorMapFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Color Map file '" << _file << "'"); + LERROR(fmt::format("Failed to open Color Map file '{}'", _file)); return false; } @@ -1329,7 +1333,7 @@ bool RenderableBillboardsCloud::readLabelFile() { std::string _file = _labelFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Label file '" << _file << "'"); + LERROR(fmt::format("Failed to open Label file '{}'", _file)); return false; } @@ -1464,7 +1468,7 @@ bool RenderableBillboardsCloud::loadCachedFile(const std::string& file) { return success; } else { - LERROR("Error opening file '" << file << "' for loading cache file"); + LERROR(fmt::format("Error opening file '{}' for loading cache file", file)); return false; } } @@ -1516,7 +1520,7 @@ bool RenderableBillboardsCloud::saveCachedFile(const std::string& file) const { return success; } else { - LERROR("Error opening file '" << file << "' for save cache file"); + LERROR(fmt::format("Error opening file '{}' for save cache file", file)); return false; } } diff --git a/modules/digitaluniverse/rendering/renderabledumeshes.cpp b/modules/digitaluniverse/rendering/renderabledumeshes.cpp index af0fe19bfb..6d6e4aaa77 100644 --- a/modules/digitaluniverse/rendering/renderabledumeshes.cpp +++ b/modules/digitaluniverse/rendering/renderabledumeshes.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include @@ -644,7 +644,7 @@ bool RenderableDUMeshes::loadData() { // else // { // LINFO("Cache for Speck file '" << _file << "' not found"); - LINFO("Loading Speck file '" << _file << "'"); + LINFO(fmt::format("Loading Speck file '{}'", _file)); success = readSpeckFile(); if (!success) { @@ -679,7 +679,7 @@ bool RenderableDUMeshes::loadData() { // } // else { // LINFO("Cache for Label file '" << labelFile << "' not found"); - LINFO("Loading Label file '" << labelFile << "'"); + LINFO(fmt::format("Loading Label file '{}'", labelFile)); success &= readLabelFile(); if (!success) { @@ -696,7 +696,7 @@ bool RenderableDUMeshes::readSpeckFile() { std::string _file = _speckFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Speck file '" << _file << "'"); + LERROR(fmt::format("Failed to open Speck file '{}'", _file)); return false; } @@ -820,7 +820,7 @@ bool RenderableDUMeshes::readLabelFile() { std::string _file = _labelFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Label file '" << _file << "'"); + LERROR(fmt::format("Failed to open Label file '{}'", _file)); return false; } @@ -933,7 +933,7 @@ bool RenderableDUMeshes::loadCachedFile(const std::string& file) { return success; } else { - LERROR("Error opening file '" << file << "' for loading cache file"); + LERROR(fmt::format("Error opening file '{}' for loading cache file", file)); return false; } } @@ -966,7 +966,7 @@ bool RenderableDUMeshes::saveCachedFile(const std::string& file) const { return success; } else { - LERROR("Error opening file '" << file << "' for save cache file"); + LERROR(fmt::format("Error opening file '{}' for save cache file", file)); return false; } } diff --git a/modules/digitaluniverse/rendering/renderableplanescloud.cpp b/modules/digitaluniverse/rendering/renderableplanescloud.cpp index e5f3c8d358..70d59fd4b8 100644 --- a/modules/digitaluniverse/rendering/renderableplanescloud.cpp +++ b/modules/digitaluniverse/rendering/renderableplanescloud.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include @@ -869,7 +869,7 @@ bool RenderablePlanesCloud::loadData() { // else // { // LINFO("Cache for Speck file '" << _file << "' not found"); - LINFO("Loading Speck file '" << _file << "'"); + LINFO(fmt::format("Loading Speck file '{}'", _file)); success = readSpeckFile(); if (!success) { @@ -905,7 +905,7 @@ bool RenderablePlanesCloud::loadData() { // else // { // LINFO("Cache for Label file '" << labelFile << "' not found"); - LINFO("Loading Label file '" << labelFile << "'"); + LINFO(fmt::format("Loading Label file '{}'", labelFile)); success &= readLabelFile(); if (!success) { @@ -928,7 +928,7 @@ bool RenderablePlanesCloud::loadTextures() { if (p.second) { LINFOC( "RenderablePlanesCloud", - "Loaded texture from '" << pair.second << "'" + fmt::format("Loaded texture from '{}'", pair.second) ); auto it = p.first; it->second->uploadTexture(); @@ -946,7 +946,7 @@ bool RenderablePlanesCloud::readSpeckFile() { std::string _file = _speckFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Speck file '" << _file << "'"); + LERROR(fmt::format("Failed to open Speck file '{}'", _file)); return false; } @@ -1117,7 +1117,7 @@ bool RenderablePlanesCloud::readLabelFile() { std::string _file = _labelFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Label file '" << _file << "'"); + LERROR(fmt::format("Failed to open Label file '{}'", _file)); return false; } @@ -1228,7 +1228,7 @@ bool RenderablePlanesCloud::loadCachedFile(const std::string& file) { return success; } else { - LERROR("Error opening file '" << file << "' for loading cache file"); + LERROR(fmt::format("Error opening file '{}' for loading cache file", file)); return false; } } @@ -1261,7 +1261,7 @@ bool RenderablePlanesCloud::saveCachedFile(const std::string& file) const { return success; } else { - LERROR("Error opening file '" << file << "' for save cache file"); + LERROR(fmt::format("Error opening file '{}' for save cache file", file)); return false; } } diff --git a/modules/digitaluniverse/rendering/renderablepoints.cpp b/modules/digitaluniverse/rendering/renderablepoints.cpp index 809e11e950..12f7351d60 100644 --- a/modules/digitaluniverse/rendering/renderablepoints.cpp +++ b/modules/digitaluniverse/rendering/renderablepoints.cpp @@ -30,7 +30,8 @@ #include #include -#include +#include +#include #include #include #include @@ -369,11 +370,9 @@ void RenderablePoints::update(const UpdateData&) { if (_vao == 0) { glGenVertexArrays(1, &_vao); - LDEBUG("Generating Vertex Array id '" << _vao << "'"); } if (_vbo == 0) { glGenBuffers(1, &_vbo); - LDEBUG("Generating Vertex Buffer Object id '" << _vbo << "'"); } glBindVertexArray(_vao); @@ -436,7 +435,10 @@ void RenderablePoints::update(const UpdateData&) { absPath(_spriteTexturePath) ); if (_spriteTexture) { - LDEBUG("Loaded texture from '" << absPath(_spriteTexturePath) << "'"); + LDEBUG(fmt::format( + "Loaded texture from '{}'", + absPath(_spriteTexturePath) + )); _spriteTexture->uploadTexture(); } _spriteTexture->setFilter( @@ -462,9 +464,11 @@ bool RenderablePoints::loadData() { bool hasCachedFile = FileSys.fileExists(cachedFile); if (hasCachedFile) { - LINFO( - "Cached file '" << cachedFile << "' used for Speck file '" << _file << "'" - ); + LINFO(fmt::format( + "Cached file '{}' used for Speck file '{}'", + cachedFile, + _file + )); bool success = loadCachedFile(cachedFile); if (success) { @@ -480,9 +484,9 @@ bool RenderablePoints::loadData() { } } else { - LINFO("Cache for Speck file '" << _file << "' not found"); + LINFO(fmt::format("Cache for Speck file '{}' not found", _file)); } - LINFO("Loading Speck file '" << _file << "'"); + LINFO(fmt::format("Loading Speck file '{}'", _file)); bool success = readSpeckFile(); if (!success) { @@ -503,7 +507,7 @@ bool RenderablePoints::readSpeckFile() { std::string _file = _speckFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Speck file '" << _file << "'"); + LERROR(fmt::format("Failed to open Speck file '{}'", _file)); return false; } @@ -571,7 +575,7 @@ bool RenderablePoints::readColorMapFile() { std::string _file = _colorMapFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Color Map file '" << _file << "'"); + LERROR(fmt::format("Failed to open Color Map file '{}'", _file)); return false; } @@ -643,7 +647,10 @@ bool RenderablePoints::loadCachedFile(const std::string& file) { return success; } else { - LERROR("Error opening file '" << file << "' for loading cache file"); + LERROR(fmt::format( + "Error opening file '{}' for loading cache file", + file + )); return false; } } @@ -676,7 +683,7 @@ bool RenderablePoints::saveCachedFile(const std::string& file) const { return success; } else { - LERROR("Error opening file '" << file << "' for save cache file"); + LERROR(fmt::format("Error opening file '{}' for save cache file", file)); return false; } } diff --git a/modules/fieldlines/rendering/renderablefieldlines.cpp b/modules/fieldlines/rendering/renderablefieldlines.cpp index 6f4db47149..823eeebaf9 100644 --- a/modules/fieldlines/rendering/renderablefieldlines.cpp +++ b/modules/fieldlines/rendering/renderablefieldlines.cpp @@ -136,20 +136,17 @@ RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary) bool success = dictionary.getValue(keyVectorField, _vectorFieldInfo); if (!success) { - LERROR("Renderable does not contain a key for '" << - keyVectorField << "'"); + LERROR(fmt::format("Renderable does not contain a key for '{}'", keyVectorField)); } success = dictionary.getValue(keyFieldlines, _fieldlineInfo); if (!success) { - LERROR("Renderable does not contain a key for '" << - keyFieldlines << "'"); + LERROR(fmt::format("Renderable does not contain a key for '{}'", keyFieldlines)); } success = dictionary.getValue(keySeedPoints, _seedPointsInfo); if (!success) { - LERROR("Renderable does not contain a key for '" << - keySeedPoints << "'"); + LERROR(fmt::format("Renderable does not contain a key for '{}", keySeedPoints)); } // @TODO a non-magic number perhaps ---abock @@ -320,7 +317,7 @@ void RenderableFieldlines::update(const UpdateData&) { fieldlines[j].end() ); } - LDEBUG("Number of vertices : " << vertexData.size()); + LDEBUG(fmt::format("Number of vertices: {}", vertexData.size())); if (_fieldlineVAO == 0) { glGenVertexArrays(1, &_fieldlineVAO); @@ -383,13 +380,14 @@ void RenderableFieldlines::loadSeedPoints() { } void RenderableFieldlines::loadSeedPointsFromFile() { - LINFO("Reading seed points from file '" << _seedPointSourceFile.value() << "'"); + LINFO(fmt::format("Reading seed points from '{}'", _seedPointSourceFile.value())); std::ifstream seedFile(_seedPointSourceFile); if (!seedFile.good()) - LERROR( - "Could not open seed points file '" << _seedPointSourceFile.value() << "'" - ); + LERROR(fmt::format( + "Could not open seed points file '{}'", + _seedPointSourceFile.value() + )); else { std::string line; glm::vec3 point; @@ -419,8 +417,11 @@ std::vector RenderableFieldlines::generateFieldlines std::string type; bool success = _vectorFieldInfo.getValue(keyVectorFieldType, type); if (!success) { - LERROR(keyVectorField << " does not contain a '" << - keyVectorFieldType << "' key"); + LERROR(fmt::format( + "{} does not contain a '{}' key", + keyVectorField, + keyVectorFieldType + )); return {}; } @@ -428,8 +429,11 @@ std::vector RenderableFieldlines::generateFieldlines return generateFieldlinesVolumeKameleon(); } else { - LERROR(keyVectorField << "." << keyVectorFieldType << - " does not name a valid type"); + LERROR(fmt::format( + "{}.{} does not name a valid type", + keyVectorField, + keyVectorFieldType + )); return {}; } } @@ -440,14 +444,14 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon() std::string model; bool success = _vectorFieldInfo.getValue(keyVectorFieldVolumeModel, model); if (!success) { - LERROR(keyVectorField << " does not name a model"); + LERROR(fmt::format("{} does not name a model", keyVectorField)); return {}; } std::string fileName; success = _vectorFieldInfo.getValue(keyVectorFieldFile, fileName); if (!success) { - LERROR(keyVectorField << " does not name a file"); + LERROR(fmt::format("{} does not name a file", keyVectorField)); return {}; } fileName = absPath(fileName); @@ -456,8 +460,12 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon() if (model != vectorFieldKameleonModelBATSRUS) { //modelType = KameleonWrapper::Model::BATSRUS; //else { - LERROR(keyVectorField << "." << keyVectorFieldVolumeModel << " model '" << - model << "' not supported"); + LERROR(fmt::format( + "{}.{} model '{}' not supported", + keyVectorField, + keyVectorFieldVolumeModel, + model + )); return {}; } @@ -475,7 +483,7 @@ RenderableFieldlines::generateFieldlinesVolumeKameleon() (_vectorFieldInfo.value(v1) == vectorFieldKameleonVariableLorentz); if (!threeVariables && !lorentzForce) { - LERROR(keyVectorField << " does not name variables"); + LERROR(fmt::format("'{}' does not name variables", keyVectorField)); return {}; } diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index c6f6bb2cfd..a7cbb4869f 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -213,8 +213,9 @@ namespace { tmp = std::stof(input); } catch (const std::invalid_argument& ia) { - LWARNING("Invalid argument: " << ia.what() << ". '" << input << - "' is NOT a valid number!"); + LWARNING(fmt::format( + "Invalid argument: {}. '{}' is NOT a valid number", ia.what(), input + )); return backupValue; } return tmp; @@ -364,8 +365,9 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary( // ------------------- EXTRACT MANDATORY VALUES FROM DICTIONARY ------------------- // std::string inputFileTypeString; if (!_dictionary->getValue(KeyInputFileType, inputFileTypeString)) { - LERROR(_name << ": The field " << std::string(KeyInputFileType) << " is missing!"); - return false; + LERROR(fmt::format( + "{}: The field {} is missing", _name, KeyInputFileType + )); } else { std::transform( @@ -385,10 +387,10 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary( sourceFileType = SourceFileType::Osfls; } else { - LERROR( - _name << ": " << inputFileTypeString << " is not a recognized " << - KeyInputFileType - ); + LERROR(fmt::format( + "{}: {} is not a recognized {}", + _name, inputFileTypeString, KeyInputFileType + )); sourceFileType = SourceFileType::Invalid; return false; } @@ -396,7 +398,9 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary( std::string sourceFolderPath; if (!_dictionary->getValue(KeySourceFolder, sourceFolderPath)) { - LERROR(_name << ": The field " << std::string(KeySourceFolder) << " is missing!"); + LERROR(fmt::format( + "{}: The field {} is missing", _name, KeySourceFolder + )); return false; } @@ -425,16 +429,17 @@ bool RenderableFieldlinesSequence::extractMandatoryInfoFromDictionary( }), _sourceFiles.end()); // Ensure that there are available and valid source files left if (_sourceFiles.empty()) { - LERROR( - _name << ": " << sourceFolderPath << " contains no ." << - inputFileTypeString << " files!" - ); + LERROR(fmt::format( + "{}: {} contains no {} files", + _name, sourceFolderPath, inputFileTypeString + )); return false; } } else { - LERROR(_name << ": FieldlinesSequence" << sourceFolderPath - << " is not a valid directory!"); + LERROR(fmt::format( + "{}: FieldlinesSequence {} is not a valid directory", _name, sourceFolderPath + )); return false; } @@ -451,10 +456,10 @@ void RenderableFieldlinesSequence::extractOptionalInfoFromDictionary( outputFolderPath = absPath(outputFolderPath); } else { - LERROR( - _name << ": The specified output path: '" << - outputFolderPath << "', does not exist!" - ); + LERROR(fmt::format( + "{}: The specified output path: '{}', does not exist", + _name, outputFolderPath + )); outputFolderPath = ""; } } @@ -512,7 +517,9 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod model = fls::stringToModel(modelStr); } else { - LERROR(_name << ": Must specify '" << KeyJsonSimulationModel << "'"); + LERROR(fmt::format( + "{}: Must specify '{}'", _name, KeyJsonSimulationModel + )); return false; } @@ -521,8 +528,10 @@ bool RenderableFieldlinesSequence::extractJsonInfoFromDictionary(fls::Model& mod _scalingFactor = scaleFactor; } else { - LWARNING(_name << ": Does not provide scalingFactor! " << - "Assumes coordinates are already expressed in meters!"); + LWARNING(fmt::format( + "{}: Does not provide scalingFactor. Assumes coordinates are in meters", + _name + )); } return true; } @@ -573,7 +582,7 @@ void RenderableFieldlinesSequence::loadOsflsStatesIntoRAM(const std::string& out } } else { - LWARNING("Failed to load state from: " << filePath); + LWARNING(fmt::format("Failed to load state from: {}", filePath)); } } } @@ -584,8 +593,10 @@ void RenderableFieldlinesSequence::extractOsflsInfoFromDictionary() { _loadingStatesDynamically = shouldLoadInRealtime; } else { - LWARNING(_name << ": " << KeyOslfsLoadAtRuntime << - " isn't specified! States will be stored in RAM!"); + LWARNING(fmt::format( + "{}: {} is not specified. States will be stored in RAM", + _name, KeyOslfsLoadAtRuntime + )); } } @@ -721,7 +732,9 @@ void RenderableFieldlinesSequence::definePropertyCallbackFunctions() { _pFocusOnOriginBtn.onChange([this] { SceneGraphNode* node = OsEng.renderEngine().scene()->sceneGraphNode(_name); if (!node) { - LWARNING("Could not find a node in scenegraph called '" << _name << "'"); + LWARNING(fmt::format( + "Could not find a node in scenegraph called '{}'", _name + )); return; } OsEng.navigationHandler().setFocusNode(node->parent()); @@ -868,20 +881,23 @@ bool RenderableFieldlinesSequence::extractCdfInfoFromDictionary(std::string& see seedFilePath = absPath(seedFilePath); } else { - LERROR(_name << ": The specified seed point file: '" << - seedFilePath << "', does not exist!"); + LERROR(fmt::format( + "{}: The specified seed poitn file: '{}' does not exist", + _name, seedFilePath + )); return false; } } else { - LERROR(_name << ": Must specify '" << KeyCdfSeedPointFile << "'"); + LERROR(fmt::format("{}: Must specify '{}'", _name, KeyCdfSeedPointFile)); return false; } if (!_dictionary->getValue(KeyCdfTracingVariable, tracingVar)) { tracingVar = "b"; // Magnetic field variable as default - LWARNING(_name << ": No '" << KeyCdfTracingVariable << "', using default: " - << tracingVar); + LWARNING(fmt::format("{}: No '{}', using default '{}'", + _name, KeyCdfTracingVariable, tracingVar + )); } ghoul::Dictionary extraQuantityNamesDictionary; @@ -902,11 +918,11 @@ bool RenderableFieldlinesSequence::extractSeedPointsFromFile(const std::string& std::ifstream seedFile(FileSys.relativePath(path)); if (!seedFile.good()) { - LERROR("Could not open seed points file '" << path << "'"); + LERROR(fmt::format("Could not open seed points file '{}'", path)); return false; } - LDEBUG("Reading seed points from file '" << path << "'"); + LDEBUG(fmt::format("Reading seed points from file '{}'", path)); std::string line; while (std::getline(seedFile, line)) { glm::vec3 point; @@ -918,7 +934,7 @@ bool RenderableFieldlinesSequence::extractSeedPointsFromFile(const std::string& } if (outVec.size() == 0) { - LERROR("Found no seed points in: " << path); + LERROR(fmt::format("Found no seed points in: {}", path)); return false; } diff --git a/modules/fieldlinessequence/util/fieldlinesstate.cpp b/modules/fieldlinessequence/util/fieldlinesstate.cpp index 1526c87f0c..5fa896e29a 100644 --- a/modules/fieldlinessequence/util/fieldlinesstate.cpp +++ b/modules/fieldlinessequence/util/fieldlinesstate.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -142,7 +143,7 @@ bool FieldlinesState::loadStateFromJson(const std::string& pathToJsonFile, std::ifstream ifs(pathToJsonFile); if (!ifs.is_open()) { - LERROR("FAILED TO OPEN FILE: " << pathToJsonFile); + LERROR(fmt::format("FAILED TO OPEN FILE: {}", pathToJsonFile)); return false; } @@ -254,7 +255,9 @@ void FieldlinesState::saveStateToOsfls(const std::string& absPath) { std::ofstream ofs(absPath + fileName, std::ofstream::binary | std::ofstream::trunc); if (!ofs.is_open()) { - LERROR("Failed to save state to binary file: " << absPath << fileName); + LERROR(fmt::format( + "Failed to save state to binary file: {}{}", absPath, fileName + )); return; } @@ -326,10 +329,12 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) { const char* ext = ".json"; std::ofstream ofs(absPath + ext, std::ofstream::trunc); if (!ofs.is_open()) { - LERROR("Failed to save state to json file at location: " << absPath << ext); + LERROR(fmt::format( + "Failed to save state to json file at location: {}{}", absPath, ext + )); return; } - LINFO("Saving fieldline state to: " << absPath << ext ); + LINFO(fmt::format("Saving fieldline state to: {}{}", absPath, ext)); json jColumns = { "x", "y", "z" }; for (const std::string& s : _extraQuantityNames) { @@ -369,7 +374,7 @@ void FieldlinesState::saveStateToJson(const std::string& absPath) { const int indentationSpaces = 2; ofs << std::setw(indentationSpaces) << jFile << std::endl; - LINFO("Saved fieldline state to: " << absPath << ext ); + LINFO(fmt::format("Saved fieldline state to: {}{}", absPath, ext)); } // Returns one of the extra quantity vectors, _extraQuantities[index]. diff --git a/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp b/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp index f54673cf6f..50faa35468 100644 --- a/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp +++ b/modules/fieldlinessequence/util/kameleonfieldlinehelper.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -151,8 +152,10 @@ bool addLinesToState(ccmc::Kameleon* kameleon, const std::vector& see innerBoundaryLimit = 0.11f; // TODO specify in Lua? break; default: - LERROR("OpenSpace's fieldlines sequence currently only supports CDFs from " - << "the BATSRUS and ENLIL models!"); + LERROR( + "OpenSpace's fieldlines sequence currently only supports CDFs from the " + "BATSRUS and ENLIL models!" + ); return false; } @@ -302,14 +305,16 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon, (model == fls::Model::Batsrus && (str == TAsPOverRho || str == "T" ))) { LDEBUG("BATSRUS doesn't contain variable T for temperature. Trying to " - << "calculate it using the ideal gas law: T = pressure/density"); + "calculate it using the ideal gas law: T = pressure/density"); const std::string p = "p", r = "rho"; success = kameleon->doesVariableExist(p) && kameleon->loadVariable(p) && kameleon->doesVariableExist(r) && kameleon->loadVariable(r); str = TAsPOverRho; } if (!success) { - LWARNING("Failed to load extra variable: '" << str << "'. Ignoring it!"); + LWARNING(fmt::format( + "Failed to load extra variable: '{}'. Ignoring", str + )); extraScalarVars.erase(extraScalarVars.begin() + i); --i; } else { @@ -346,9 +351,11 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon, name = JParallelB; } if (!success) { - LWARNING("Failed to load at least one of the magnitude variables: " - << s1 << ", " << s2 << " & " << s3 - << ". Removing ability to store corresponding magnitude!"); + LWARNING(fmt::format( + "Failed to load at least one of the magnitude variables: {}, {}, {} " + "& {}. Removing ability to store corresponding magnitude", + s1, s2, s3 + )); extraMagVars.erase( extraMagVars.begin() + i, extraMagVars.begin() + i + 3 @@ -361,9 +368,11 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon, } else { // WRONG NUMBER OF MAGNITUDE VARIABLES.. REMOVE ALL! extraMagVars.clear(); - LWARNING("Wrong number of variables provided for storing magnitudes. " - << "Expects multiple of 3 but " << extraMagVars.size() - << " are provided"); + LWARNING(fmt::format( + "Wrong number of variables provided for storing magnitudes. Expects multiple " + "of 3 but {} are provided", + extraMagVars.size() + )); } state.setExtraQuantityNames(std::move(extraQuantityNames)); } diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index f106725005..412667d56e 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -272,6 +272,14 @@ scripting::LuaLibrary GlobeBrowsingModule::luaLibrary() const { "getGeoPosition", &globebrowsing::luascriptfunctions::getGeoPosition, {}, + "name, latitude, longitude, altitude", + "Returns the specified surface position on the globe as three floating point " + "values" + }, + { + "getGeoPositionForCamera", + &globebrowsing::luascriptfunctions::getGeoPositionForCamera, + {}, "void", "Get geographic coordinates of the camera poosition in latitude, " "longitude, and altitude" @@ -348,6 +356,28 @@ void GlobeBrowsingModule::goToGeo(double latitude, double longitude, ); } +glm::vec3 GlobeBrowsingModule::cartesianCoordinatesFromGeo( + globebrowsing::RenderableGlobe& globe, + double latitude, double longitude, double altitude) +{ + using namespace globebrowsing; + + Geodetic3 pos = { + { + Angle::fromDegrees(latitude).asRadians(), + Angle::fromDegrees(longitude).asRadians() + }, + altitude + }; + + glm::dvec3 positionModelSpace = globe.ellipsoid().cartesianPosition(pos); + //glm::dmat4 modelTransform = globe.modelTransform(); + //glm::dvec3 positionWorldSpace = glm::dvec3(modelTransform * + //glm::dvec4(positionModelSpace, 1.0)); + + return glm::vec3(positionModelSpace); +} + void GlobeBrowsingModule::goToChunk(Camera& camera, globebrowsing::TileIndex ti, glm::vec2 uv, bool resetCameraDirection) { @@ -362,8 +392,9 @@ void GlobeBrowsingModule::goToChunk(Camera& camera, globebrowsing::TileIndex ti, // Camera position in model space glm::dvec3 camPos = camera.positionVec3(); glm::dmat4 inverseModelTransform = globe->inverseModelTransform(); - glm::dvec3 cameraPositionModelSpace = - glm::dvec3(inverseModelTransform * glm::dvec4(camPos, 1)); + glm::dvec3 cameraPositionModelSpace = glm::dvec3( + inverseModelTransform * glm::dvec4(camPos, 1) + ); GeodeticPatch patch(ti); Geodetic2 corner = patch.getCorner(SOUTH_WEST); diff --git a/modules/globebrowsing/globebrowsingmodule.h b/modules/globebrowsing/globebrowsingmodule.h index aaf588032e..fcb3aacdf7 100644 --- a/modules/globebrowsing/globebrowsingmodule.h +++ b/modules/globebrowsing/globebrowsingmodule.h @@ -53,6 +53,9 @@ public: void goToGeo(double latitude, double longitude); void goToGeo(double latitude, double longitude, double altitude); + glm::vec3 cartesianCoordinatesFromGeo(globebrowsing::RenderableGlobe& globe, + double latitude, double longitude, double altitude); + globebrowsing::cache::MemoryAwareTileCache* tileCache(); scripting::LuaLibrary luaLibrary() const override; globebrowsing::RenderableGlobe* castFocusNodeRenderableToGlobe(); diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index c35807d5c8..ff1437d438 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -34,6 +34,7 @@ #include #include #include +#include namespace openspace::globebrowsing::luascriptfunctions { @@ -175,7 +176,40 @@ int goToGeo(lua_State* L) { } int getGeoPosition(lua_State* L) { - ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::getGeoPosition"); + ghoul::lua::checkArgumentsAndThrow(L, 4, "lua::getGeoPosition"); + + std::string name = luaL_checkstring(L, 1); + double latitude = lua_tonumber(L, 2); + double longitude = lua_tonumber(L, 3); + double altitude = lua_tonumber(L, 4); + + lua_settop(L, 0); + ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); + + SceneGraphNode* n = sceneGraphNode(name); + Renderable* r = n->renderable(); + RenderableGlobe* g = dynamic_cast(r); + if (!g) { + return luaL_error(L, "Name must be a RenderableGlobe"); + } + + + GlobeBrowsingModule& mod = *(OsEng.moduleEngine().module()); + glm::vec3 pos = mod.cartesianCoordinatesFromGeo( + *g, + latitude, + longitude, + altitude + ); + + lua_pushnumber(L, pos.x); + lua_pushnumber(L, pos.y); + lua_pushnumber(L, pos.z); + return 3; +} + +int getGeoPositionForCamera(lua_State* L) { + ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::getGeoPositionForCamera"); GlobeBrowsingModule* module = OsEng.moduleEngine().module(); RenderableGlobe* globe = module->castFocusNodeRenderableToGlobe(); diff --git a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.cpp b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.cpp index 47e7b8bba0..b4c139a39b 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/gdalwrapper.cpp @@ -65,14 +65,14 @@ namespace { namespace openspace::globebrowsing { -void gdalErrorHandler(CPLErr eErrClass, int, const char *msg) { +void gdalErrorHandler(CPLErr eErrClass, int, const char* msg) { if (GdalWrapper::ref().logGdalErrors()) { switch (eErrClass) { case CE_None: break; - case CE_Debug: LDEBUG ("GDAL " << msg); break; - case CE_Warning: LWARNING("GDAL " << msg); break; - case CE_Failure: LERROR ("GDAL " << msg); break; - case CE_Fatal: LFATAL ("GDAL " << msg); break; + case CE_Debug: LDEBUGC ("GDAL", msg); break; + case CE_Warning: LWARNINGC("GDAL", msg); break; + case CE_Failure: LERRORC ("GDAL", msg); break; + case CE_Fatal: LFATALC ("GDAL", msg); break; } } } @@ -188,12 +188,12 @@ void GdalWrapper::setGdalProxyConfiguration() { if (success) { std::string proxy = proxyAddress + ":" + proxyPort; CPLSetConfigOption("GDAL_HTTP_PROXY", proxy.c_str()); - LDEBUG("Using proxy server " << proxy); + LDEBUG(fmt::format("Using proxy server {}", proxy)); if (userAndPassword) { std::string proxyUserPwd = proxyUser + ":" + proxyPassword; CPLSetConfigOption("GDAL_HTTP_PROXYUSERPWD", proxyUserPwd.c_str()); CPLSetConfigOption("GDAL_HTTP_PROXYAUTH", proxyAuthString.c_str()); - LDEBUG("Using authentication method: " << proxyAuthString); + LDEBUG(fmt::format("Using authentication method: {}", proxyAuthString)); } } else { LERROR("Invalid proxy settings for GDAL"); diff --git a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp index 214423b89d..7692320135 100644 --- a/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp +++ b/modules/globebrowsing/tile/rawtiledatareader/tiledatatype.cpp @@ -47,7 +47,8 @@ #include #include - +#include +#include #include #include @@ -151,7 +152,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) { // format.glFormat = GL_RED; // break; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } break; @@ -180,7 +181,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) { format.glFormat = GL_RED; break; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } break; @@ -210,7 +211,7 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) { // format.glFormat = GL_RED; // break; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } break; @@ -240,12 +241,15 @@ TextureFormat getTextureFormat(int rasterCount, GDALDataType gdalType) { // format.glFormat = GL_RED; // break; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } break; default: - LERROR("Unknown number of channels for OpenGL texture: " << rasterCount); + LERROR(fmt::format( + "Unknown number of channels for OpenGL texture: {}", + rasterCount + )); throw ghoul::MissingCaseException(); } return format; @@ -281,7 +285,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType) // format.glFormat = GL_RED; // break; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } break; @@ -310,7 +314,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType) format.glFormat = GL_RED; break; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } break; @@ -340,7 +344,7 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType) // format.glFormat = GL_RED; // break; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } break; @@ -370,12 +374,12 @@ TextureFormat getTextureFormatOptimized(int rasterCount, GDALDataType gdalType) // format.glFormat = GL_RED; // break; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } break; default: - LERROR("Unknown number of channels for OpenGL texture: " << rasterCount); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } return format; @@ -398,7 +402,7 @@ GLenum getOpenGLDataType(GDALDataType gdalType) { case GDT_Float64: return GL_DOUBLE; default: - LERROR("GDAL data type unknown to OpenGL: " << gdalType); + LERROR(fmt::format("GDAL data type unknown to OpenGL: {}", gdalType)); throw ghoul::MissingCaseException(); } } @@ -420,7 +424,7 @@ GDALDataType getGdalDataType(GLenum glType) { case GL_DOUBLE: return GDT_Float64; default: - LERROR("OpenGL data type unknown to GDAL: " << glType); + LERROR(fmt::format("OpenGL data type unknown to GDAL: {}", glType)); throw ghoul::MissingCaseException(); } } @@ -441,7 +445,7 @@ size_t numberOfRasters(ghoul::opengl::Texture::Format format) { return 4; default: { ghoul_assert(false, "Unknown format"); - return 0; + throw ghoul::MissingCaseException(); } } } @@ -526,7 +530,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { return GL_R16F; default: ghoul_assert(false, "glType data type unknown"); - LERROR("glType data type unknown: " << glType); + LERROR(fmt::format("glType data type unknown: {}", glType)); throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::RG: @@ -545,7 +549,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { return GL_RG16F; default: ghoul_assert(false, "glType data type unknown"); - LERROR("glType data type unknown: " << glType); + LERROR(fmt::format("glType data type unknown: {}", glType)); throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::RGB: @@ -564,7 +568,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { return GL_RGB16F; default: ghoul_assert(false, "glType data type unknown"); - LERROR("glType data type unknown: " << glType); + LERROR(fmt::format("glType data type unknown: {}", glType)); throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::RGBA: @@ -583,7 +587,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { return GL_RGBA16F; default: ghoul_assert(false, "glType data type unknown"); - LERROR("glType data type unknown: " << glType); + LERROR(fmt::format("glType data type unknown: {}", glType)); throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::BGR: @@ -602,7 +606,7 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { return GL_RGB16F; default: ghoul_assert(false, "glType data type unknown"); - LERROR("glType data type unknown: " << glType); + LERROR(fmt::format("glType data type unknown: {}", glType)); throw ghoul::MissingCaseException(); } case ghoul::opengl::Texture::Format::BGRA: @@ -621,16 +625,16 @@ GLenum glTextureFormat(GLenum glType, ghoul::opengl::Texture::Format format) { return GL_RGBA16F; default: ghoul_assert(false, "glType data type unknown"); - LERROR("glType data type unknown: " << glType); + LERROR(fmt::format("glType data type unknown: {}", glType)); throw ghoul::MissingCaseException(); } default: - LERROR( - "Unknown format for OpenGL texture: " << + LERROR(fmt::format( + "Unknown format for OpenGL texture: {}", static_cast>( format ) - ); + )); throw ghoul::MissingCaseException(); } } diff --git a/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp b/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp index eaa31ba04c..e854cc39fc 100644 --- a/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/defaulttileprovider.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include @@ -92,7 +92,7 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary) double pixelSize = 0.0; int tilePixelSize = 0; if (dictionary.getValue(KeyTilePixelSize, pixelSize)) { - LDEBUG("Default pixel size overridden: " << pixelSize); + LDEBUG(fmt::format("Default pixel size overridden: {}", pixelSize)); tilePixelSize = static_cast(pixelSize); } @@ -106,7 +106,10 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary) _performPreProcessing = LayerManager::shouldPerformPreProcessingOnLayergroup(_layerGroupID); if (dictionary.getValue(KeyPerformPreProcessing, _performPreProcessing)) { - LDEBUG("Default PerformPreProcessing overridden: " << _performPreProcessing); + LDEBUG(fmt::format( + "Default PerformPreProcessing overridden: {}", + _performPreProcessing + )); } if (dictionary.hasKeyAndValue(KeyPreCacheLevel)) { @@ -241,7 +244,11 @@ void DefaultTileProvider::initAsyncTileDataReader(TileTextureInitData initData) // Tiles are only available for levels 2 and higher. if (_preCacheLevel >= 2) { - LDEBUG("Precaching '" << _filePath << "' with level '" << _preCacheLevel << "'"); + LDEBUG(fmt::format( + "Precaching '{}' with level '{}'", + _filePath.value(), + _preCacheLevel + )); for (int level = 0; level <= _preCacheLevel; ++level) { for (int x = 0; x <= level * 2; ++x) { for (int y = 0; y <= level; ++y) { diff --git a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp index 2f5092b084..7b74752ed6 100644 --- a/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/temporaltileprovider.cpp @@ -28,11 +28,12 @@ #include -#include +#include +#include #include #include "cpl_minixml.h" -#include +#include #include namespace { @@ -105,7 +106,7 @@ bool TemporalTileProvider::initialize() { bool success = TileProvider::initialize(); if (!_preCacheTimes.empty()) { - LINFO("Preloading: " << _filePath.value()); + LINFO(fmt::format("Preloading: {}", _filePath.value())); for (const Time& t : _preCacheTimes) { getTileProvider(t); } diff --git a/modules/imgui/src/gui.cpp b/modules/imgui/src/gui.cpp index 092693a1f7..2d9c07ef40 100644 --- a/modules/imgui/src/gui.cpp +++ b/modules/imgui/src/gui.cpp @@ -51,7 +51,7 @@ const char* configurationFile = "imgui.ini"; //const char* GuiFont = "${FONTS}/ubuntu/Ubuntu-Regular.ttf"; const char* GuiFont = "${FONTS}/arimo/Arimo-Regular.ttf"; const float FontSize = 14.f; -const ImVec2 size = ImVec2(500, 500); +const ImVec2 Size = ImVec2(500, 500); //GLuint fontTex = 0; // A VBO max size of 0 will cause a lazy instantiation of the buffer @@ -222,7 +222,7 @@ static void RenderDrawLists(ImDrawData* drawData) { void addScreenSpaceRenderableLocal(std::string texturePath) { if (!FileSys.fileExists(absPath(texturePath))) { - LWARNING("Could not find image '" << texturePath << "'"); + LWARNING(fmt::format("Could not find image '{}'", texturePath)); return; } diff --git a/modules/imgui/src/guiglobebrowsingcomponent.cpp b/modules/imgui/src/guiglobebrowsingcomponent.cpp index b752529318..27bdbdfe25 100644 --- a/modules/imgui/src/guiglobebrowsingcomponent.cpp +++ b/modules/imgui/src/guiglobebrowsingcomponent.cpp @@ -42,7 +42,7 @@ #include #include -#include +#include #include @@ -242,7 +242,7 @@ void GuiGlobeBrowsingComponent::render() { if (cap.empty()) { LWARNINGC( "GlobeBrowsingGUI", - "Unknown server: '" << _currentServer << "'" + fmt::format("Unknown server: '{}'", _currentServer) ); } diff --git a/modules/imgui/src/guihelpcomponent.cpp b/modules/imgui/src/guihelpcomponent.cpp index 0512580caf..e06af1b62e 100644 --- a/modules/imgui/src/guihelpcomponent.cpp +++ b/modules/imgui/src/guihelpcomponent.cpp @@ -27,7 +27,7 @@ #include namespace { - const ImVec2 size = ImVec2(350, 500); + const ImVec2 Size = ImVec2(350, 500); } // namespace namespace openspace::gui { @@ -40,7 +40,7 @@ void GuiHelpComponent::render() { ImGui::SetNextWindowCollapsed(_isCollapsed); bool v = _isEnabled; - ImGui::Begin("Help", &v, size, 0.5f); + ImGui::Begin("Help", &v, Size, 0.5f); _isEnabled = v; _isCollapsed = ImGui::IsWindowCollapsed(); ImGui::ShowUserGuide(); diff --git a/modules/imgui/src/guiiswacomponent.cpp b/modules/imgui/src/guiiswacomponent.cpp index 661382cbb1..ef16b3eae1 100644 --- a/modules/imgui/src/guiiswacomponent.cpp +++ b/modules/imgui/src/guiiswacomponent.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include diff --git a/modules/imgui/src/guiparallelcomponent.cpp b/modules/imgui/src/guiparallelcomponent.cpp index e59c591dbd..01fca59684 100644 --- a/modules/imgui/src/guiparallelcomponent.cpp +++ b/modules/imgui/src/guiparallelcomponent.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include diff --git a/modules/imgui/src/guiperformancecomponent.cpp b/modules/imgui/src/guiperformancecomponent.cpp index 9475b1b861..e954958bf1 100644 --- a/modules/imgui/src/guiperformancecomponent.cpp +++ b/modules/imgui/src/guiperformancecomponent.cpp @@ -33,7 +33,7 @@ #include -#include +#include #include #include diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index aab8911c48..69fe3b419e 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -35,7 +35,7 @@ #include namespace { - const ImVec2 size = ImVec2(350, 500); + const ImVec2 Size = ImVec2(350, 500); static const openspace::properties::Property::PropertyInfo UseTreeInfo = { "TreeLayout", @@ -252,7 +252,7 @@ void GuiPropertyComponent::render() { ImGui::SetNextWindowCollapsed(_isCollapsed); bool v = _isEnabled; - ImGui::Begin(name().c_str(), &v, size, 0.75f); + ImGui::Begin(name().c_str(), &v, Size, 0.75f); _isEnabled = v; _isCollapsed = ImGui::IsWindowCollapsed(); diff --git a/modules/iswa/rendering/iswakameleongroup.cpp b/modules/iswa/rendering/iswakameleongroup.cpp index bead33c92b..7b9ebd6b0f 100644 --- a/modules/iswa/rendering/iswakameleongroup.cpp +++ b/modules/iswa/rendering/iswakameleongroup.cpp @@ -111,12 +111,12 @@ void IswaKameleonGroup::registerProperties() { } void IswaKameleonGroup::readFieldlinePaths(std::string indexFile) { - LINFO("Reading seed points paths from file '" << indexFile << "'"); + LINFO(fmt::format("Reading seed points paths from file '{}'", indexFile)); // Read the index file from disk std::ifstream seedFile(indexFile); if (!seedFile.good()) - LERROR("Could not open seed points file '" << indexFile << "'"); + LERROR(fmt::format("Could not open seed points file '{}'", indexFile)); else { std::string line; std::string fileContent; diff --git a/modules/iswa/rendering/kameleonplane.cpp b/modules/iswa/rendering/kameleonplane.cpp index 71cfce85d0..a81bcd5fde 100644 --- a/modules/iswa/rendering/kameleonplane.cpp +++ b/modules/iswa/rendering/kameleonplane.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #ifdef __GNUC__ #pragma GCC diagnostic push @@ -318,7 +318,7 @@ void KameleonPlane::updateFieldlineSeeds() { } void KameleonPlane::readFieldlinePaths(std::string indexFile) { - LINFO("Reading seed points paths from file '" << indexFile << "'"); + LINFO(fmt::format("Reading seed points paths from file '{}'", indexFile)); if (_group) { std::dynamic_pointer_cast(_group)->setFieldlineInfo( indexFile, @@ -330,7 +330,7 @@ void KameleonPlane::readFieldlinePaths(std::string indexFile) { // Read the index file from disk std::ifstream seedFile(indexFile); if (!seedFile.good()) { - LERROR("Could not open seed points file '" << indexFile << "'"); + LERROR(fmt::format("Could not open seed points file '{}'", indexFile)); } else { try { diff --git a/modules/iswa/rendering/screenspacecygnet.cpp b/modules/iswa/rendering/screenspacecygnet.cpp index 0a6eb6bc35..2a2d831ff8 100644 --- a/modules/iswa/rendering/screenspacecygnet.cpp +++ b/modules/iswa/rendering/screenspacecygnet.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include diff --git a/modules/iswa/rendering/texturecygnet.cpp b/modules/iswa/rendering/texturecygnet.cpp index 620a46d164..20cb22317e 100644 --- a/modules/iswa/rendering/texturecygnet.cpp +++ b/modules/iswa/rendering/texturecygnet.cpp @@ -48,7 +48,9 @@ bool TextureCygnet::updateTexture() { ); if (texture) { - LDEBUG("Loaded texture from image iswa cygnet with id: '" << _data->id << "'"); + LDEBUG(fmt::format( + "Loaded texture from image iswa cygnet with id: '{}'", _data->id + )); texture->uploadTexture(); // Textures of planets looks much smoother with AnisotropicMipMap texture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); diff --git a/modules/iswa/util/dataprocessorkameleon.cpp b/modules/iswa/util/dataprocessorkameleon.cpp index 6117417201..29eb1b7439 100644 --- a/modules/iswa/util/dataprocessorkameleon.cpp +++ b/modules/iswa/util/dataprocessorkameleon.cpp @@ -24,6 +24,7 @@ #include //#include +#include #include #include diff --git a/modules/iswa/util/iswamanager.cpp b/modules/iswa/util/iswamanager.cpp index 135a1b57d2..acbaf7622e 100644 --- a/modules/iswa/util/iswamanager.cpp +++ b/modules/iswa/util/iswamanager.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/modules/kameleon/src/kameleonhelper.cpp b/modules/kameleon/src/kameleonhelper.cpp index 0a6d9a697b..a99d3e3ddf 100644 --- a/modules/kameleon/src/kameleonhelper.cpp +++ b/modules/kameleon/src/kameleonhelper.cpp @@ -39,7 +39,7 @@ #endif // _MSC_VER #include - +#include namespace { std::string _loggerCat = "KameleonHelper"; @@ -57,14 +57,17 @@ std::unique_ptr createKameleonObject(const std::string& cdfFileP // ---------------------------- CREATE KAMELEON OBJECT ---------------------------- // std::unique_ptr kameleon = std::make_unique(); - LDEBUG("\tOpening the cdf file: " << cdfFilePath); + LDEBUG(fmt::format("\tOpening the cdf file: {}", cdfFilePath)); long kamStatus = kameleon->open(cdfFilePath); if (kamStatus != ccmc::FileReader::OK) { - LERROR("Failed to create a Kameleon Object from file: " << cdfFilePath); + LERROR(fmt::format( + "Failed to create a Kameleon Object from file: {}", + cdfFilePath + )); return nullptr; } - LDEBUG("\tSuccessfully opened : " << cdfFilePath); + LDEBUG(fmt::format("\tSuccessfully opened: {}", cdfFilePath)); return kameleon; } @@ -123,8 +126,10 @@ double getTime(ccmc::Kameleon* kameleon) { seqStartStr = kameleon->getGlobalAttribute("tim_crstart_cal").getAttributeString(); } else { - LWARNING("No starting time attribute could be found in the .cdf file.\n\t" << - "Starting time is set to 01.JAN.2000 12:00."); + LWARNING( + "No starting time attribute could be found in the .cdf file. Starting " + "time is set to 01.JAN.2000 12:00." + ); seqStartDbl = 0.0; } @@ -137,7 +142,7 @@ double getTime(ccmc::Kameleon* kameleon) { Time::convertTime( seqStartStr.substr(0, seqStartStr.length() - 2)); } else { - LWARNING("No starting time attribute could be found in the .cdf file.\n\t" << + LWARNING("No starting time attribute could be found in the .cdf file." "Starting time is set to 01.JAN.2000 12:00."); seqStartDbl = 0.0; } @@ -154,7 +159,7 @@ double getTime(ccmc::Kameleon* kameleon) { "time_physical_time").getAttributeFloat()); } else { stateStartOffset = 0.0; - LWARNING("No time offset attribute could be found in the .cdf file.\n\t" << + LWARNING("No time offset attribute could be found in the .cdf file." "The current state starts the same time as the sequence!"); } diff --git a/modules/kameleon/src/kameleonwrapper.cpp b/modules/kameleon/src/kameleonwrapper.cpp index 21ffb7a5f8..886b13756b 100644 --- a/modules/kameleon/src/kameleonwrapper.cpp +++ b/modules/kameleon/src/kameleonwrapper.cpp @@ -26,6 +26,7 @@ //#include #include +#include #include #ifdef WIN32 @@ -50,6 +51,7 @@ #include #include #include +#include #include @@ -127,9 +129,9 @@ bool KameleonWrapper::open(const std::string& filename) { _gridType = getGridType(_xCoordVar, _yCoordVar, _zCoordVar); _type = getModelType(); - LDEBUG("x:" << _xCoordVar); - LDEBUG("y:" << _yCoordVar); - LDEBUG("z:" << _zCoordVar); + LDEBUG(fmt::format("x: {}", _xCoordVar)); + LDEBUG(fmt::format("y: {}", _yCoordVar)); + LDEBUG(fmt::format("z: {}", _zCoordVar)); _xMin = _model->getVariableAttribute(_xCoordVar, "actual_min").getAttributeFloat(); @@ -165,18 +167,18 @@ bool KameleonWrapper::open(const std::string& filename) { _zValidMax = _model->getVariableAttribute(_zCoordVar, "valid_max").getAttributeFloat(); - LDEBUG("_xMin: " << _xMin); - LDEBUG("_xMax: " << _xMax); - LDEBUG("_yMin: " << _yMin); - LDEBUG("_yMax: " << _yMax); - LDEBUG("_zMin: " << _zMin); - LDEBUG("_zMax: " << _zMax); - LDEBUG("_xValidMin: " << _xValidMin); - LDEBUG("_xValidMax: " << _xValidMax); - LDEBUG("_yValidMin: " << _yValidMin); - LDEBUG("_yValidMax: " << _yValidMax); - LDEBUG("_zValidMin: " << _zValidMin); - LDEBUG("_zValidMax: " << _zValidMax); + LDEBUG(fmt::format("_xMin: {}", _xMin)); + LDEBUG(fmt::format("_xMax: {}", _xMax)); + LDEBUG(fmt::format("_yMin: {}", _yMin)); + LDEBUG(fmt::format("_yMax: {}", _yMax)); + LDEBUG(fmt::format("_zMin: {}", _zMin)); + LDEBUG(fmt::format("_zMax: {}", _zMax)); + LDEBUG(fmt::format("_xValidMin: {}", _xValidMin)); + LDEBUG(fmt::format("_xValidMax: {}", _xValidMax)); + LDEBUG(fmt::format("_yValidMin: {}", _yValidMin)); + LDEBUG(fmt::format("_yValidMax: {}", _yValidMax)); + LDEBUG(fmt::format("_zValidMin: {}", _zValidMin)); + LDEBUG(fmt::format("_zValidMax: {}", _zValidMax)); return true; } @@ -203,7 +205,7 @@ float* KameleonWrapper::getUniformSampledValues( const glm::size3_t& outDimensions) { ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); - LINFO("Loading variable " << var << " from CDF data with a uniform sampling"); + LINFO(fmt::format("Loading variable {} from CDF data with a uniform sampling", var)); unsigned int size = static_cast( outDimensions.x * outDimensions.y * outDimensions.z @@ -218,8 +220,8 @@ float* KameleonWrapper::getUniformSampledValues( double stepY = (_yMax-_yMin)/(static_cast(outDimensions.y)); double stepZ = (_zMax-_zMin)/(static_cast(outDimensions.z)); - LDEBUG(var << "Min: " << varMin); - LDEBUG(var << "Max: " << varMax); + LDEBUG(fmt::format("{} Min: {}", var, varMin)); + LDEBUG(fmt::format("{} Max: {}", var, varMax)); // HISTOGRAM const int bins = 200; @@ -348,7 +350,7 @@ float* KameleonWrapper::getUniformSampledValues( // LDEBUG("===================="); break; } - LDEBUG("histogram[" << i << "]: " << histogram[i]); + LDEBUG(fmt::format("histogram[{}]: {}", i, histogram[i])); } double dist = varMax - varMin; @@ -362,10 +364,10 @@ float* KameleonWrapper::getUniformSampledValues( data[i] = static_cast(glm::clamp(normalizedVal, 0.0, 1.0)); if(data[i] < 0.0) { - LERROR("Datapoint " << i << " less than 0"); + LERROR(fmt::format("Datapoint {} less than 0", i)); } if(data[i] > 1.0) { - LERROR("Datapoint " << i << " more than 1"); + LERROR(fmt::format("Datapoint {} more than 1", i)); } } @@ -384,7 +386,10 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var, const float& slice) { ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); - LINFO("Loading variable " << var << " from CDF data with a uniform sampling"); + LINFO(fmt::format( + "Loading variable {} from CDF data with a uniform sampling", + var + )); unsigned int size = static_cast( outDimensions.x * outDimensions.y * outDimensions.z @@ -409,8 +414,8 @@ float* KameleonWrapper::getUniformSliceValues(const std::string& var, double yDim = (!ySlice)? outDimensions.y-1 : 1.0; double zDim = (!zSlice)? outDimensions.z-1 : 1.0; - LDEBUG(var << "Min: " << varMin); - LDEBUG(var << "Max: " << varMax); + LDEBUG(fmt::format("{} min: {}", var, varMin)); + LDEBUG(fmt::format("{} max: {}", var, varMax)); //double maxValue = 0.0; //double minValue = std::numeric_limits::max(); @@ -513,10 +518,13 @@ float* KameleonWrapper::getUniformSampledVectorValues(const std::string& xVar, const glm::size3_t& outDimensions) { ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); - LINFO( - "Loading variables " << xVar << " " << yVar << " " << zVar << - " from CDF data with a uniform sampling" - ); + + LINFO(fmt::format( + "loading variables {} {} {} from CDF data with a uniform sampling", + xVar, + yVar, + zVar + )); int channels = 4; unsigned int size = static_cast( @@ -590,10 +598,13 @@ KameleonWrapper::Fieldlines KameleonWrapper::getClassifiedFieldLines( float stepSize ) { ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); - LINFO( - "Creating " << seedPoints.size() << " fieldlines from variables " << - xVar << " " << yVar << " " << zVar - ); + LINFO(fmt::format( + "Creating {} fieldlines from variables {} {} {}", + seedPoints.size(), + xVar, + yVar, + zVar + )); std::vector fLine, bLine; std::vector > fieldLines; @@ -647,10 +658,13 @@ KameleonWrapper::Fieldlines KameleonWrapper::getFieldLines(const std::string& xV const std::vector& seedPoints, float stepSize, const glm::vec4& color) { ghoul_assert(_model && _interpolator, "Model and interpolator must exist"); - LINFO( - "Creating " << seedPoints.size() << " fieldlines from variables " << - xVar << " " << yVar << " " << zVar - ); + LINFO(fmt::format( + "Creating {} fieldlines from variables {} {} {}", + seedPoints.size(), + xVar, + yVar, + zVar + )); std::vector fLine, bLine; Fieldlines fieldLines; @@ -698,7 +712,7 @@ KameleonWrapper::Fieldlines KameleonWrapper::getFieldLines(const std::string& xV KameleonWrapper::Fieldlines KameleonWrapper::getLorentzTrajectories( const std::vector& seedPoints,const glm::vec4& /*color*/, float stepsize) { - LINFO("Creating " << seedPoints.size() << " Lorentz force trajectories"); + LINFO(fmt::format("Creating {} Lorentz force trajectories", seedPoints.size())); Fieldlines trajectories; std::vector plusTraj, minusTraj; @@ -926,7 +940,7 @@ KameleonWrapper::TraceLine KameleonWrapper::traceCartesianFieldline( ++numSteps; if (numSteps > maxSteps) { - LDEBUG("Max number of steps taken (" << maxSteps <<")"); + LDEBUG(fmt::format("Max number of steps taken ({})", maxSteps)); break; } } @@ -1031,7 +1045,7 @@ KameleonWrapper::TraceLine KameleonWrapper::traceLorentzTrajectory( ++numSteps; if (numSteps > maxSteps) { - LDEBUG("Max number of steps taken (" << maxSteps <<")"); + LDEBUG(fmt::format("Max number of steps taken ({})", maxSteps)); break; } } diff --git a/modules/kameleonvolume/kameleonvolumereader.cpp b/modules/kameleonvolume/kameleonvolumereader.cpp index 467823911c..0541b12009 100644 --- a/modules/kameleonvolume/kameleonvolumereader.cpp +++ b/modules/kameleonvolume/kameleonvolumereader.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #ifdef WIN32 @@ -43,6 +44,8 @@ #pragma warning (pop) #endif // WIN32 +#include + namespace { constexpr const char* _loggerCat = "KameleonVolumeReader"; } // namespace @@ -54,13 +57,13 @@ KameleonVolumeReader::KameleonVolumeReader(const std::string& path) : _path(path) { if (!FileSys.fileExists(path)) { - LERROR(_path << " does not exist"); + LERROR(fmt::format("'{}' does not exist", _path)); throw ghoul::FileNotFoundError(_path); } long status = _kameleon.open(_path); if (status != ccmc::FileReader::OK) { - LERROR("Failed to open file " << _path << " with Kameleon"); + LERROR(fmt::format("Failed to open file '{}' with Kameleon", _path)); throw ghoul::RuntimeError("Failed to open file: " + _path + " with Kameleon"); return; } diff --git a/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp b/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp index a633d27241..63051fcff4 100644 --- a/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp +++ b/modules/kameleonvolume/rendering/renderablekameleonvolume.cpp @@ -332,14 +332,13 @@ void RenderableKameleonVolume::updateRaycasterModelTransform() { _raycaster->setModelTransform(modelTransform); } - bool RenderableKameleonVolume::cachingEnabled() { return _cache; } void RenderableKameleonVolume::load() { if (!FileSys.fileExists(ghoul::filesystem::File(_sourcePath))) { - LERROR("File " << _sourcePath << " does not exist."); + LERROR(fmt::format("File '{}' does not exist.", _sourcePath.value())); return; } if (!cachingEnabled()) { diff --git a/modules/multiresvolume/rendering/brickmanager.cpp b/modules/multiresvolume/rendering/brickmanager.cpp index 4c064aa807..9eda8ba072 100644 --- a/modules/multiresvolume/rendering/brickmanager.cpp +++ b/modules/multiresvolume/rendering/brickmanager.cpp @@ -30,6 +30,7 @@ #include #include +#include namespace { constexpr const char* _loggerCat = "BrickManager"; @@ -68,20 +69,29 @@ bool BrickManager::readHeader() { _header = _tsp->header(); - LDEBUG("Grid type: " << _header.gridType_); - LDEBUG("Original num timesteps: " << _header.numOrigTimesteps_); - LDEBUG("Num timesteps: " << _header.numTimesteps_); - LDEBUG("Brick dims: " << _header.xBrickDim_ << " " << _header.yBrickDim_ << " " << _header.zBrickDim_); - LDEBUG("Num bricks: " << _header.xNumBricks_ << " " << _header.yNumBricks_ << " " << _header.zNumBricks_); - LDEBUG(""); + LDEBUG(fmt::format("Grid type: {}", _header.gridType_)); + LDEBUG(fmt::format("Original num timesteps: {}", _header.numOrigTimesteps_)); + LDEBUG(fmt::format("Num timesteps: {}", _header.numTimesteps_)); + LDEBUG(fmt::format( + "Brick dims: {} {} {}", + _header.xBrickDim_, + _header.yBrickDim_, + _header.zBrickDim_ + )); + LDEBUG(fmt::format( + "Num bricks: {} {} {}", + _header.xNumBricks_, + _header.yNumBricks_, + _header.zNumBricks_ + )); brickDim_ = _header.xBrickDim_; numBricks_ = _header.xNumBricks_; paddedBrickDim_ = brickDim_ + paddingWidth_ * 2; atlasDim_ = paddedBrickDim_*numBricks_; - LDEBUG("Padded brick dim: " << paddedBrickDim_); - LDEBUG("Atlas dim: " << atlasDim_); + LDEBUG(fmt::format("Padded brick dim: {}", paddedBrickDim_)); + LDEBUG(fmt::format("Atlas dim: {}", atlasDim_)); numBrickVals_ = paddedBrickDim_*paddedBrickDim_*paddedBrickDim_; // Number of bricks per frame @@ -92,11 +102,11 @@ bool BrickManager::readHeader() { unsigned int numOTNodes = static_cast((pow(8, numOTLevels) - 1) / 7); unsigned int numBSTNodes = static_cast(_header.numTimesteps_ * 2 - 1); numBricksTree_ = numOTNodes * numBSTNodes; - LDEBUG("Num OT levels: " << numOTLevels); - LDEBUG("Num OT nodes: " << numOTNodes); - LDEBUG("Num BST nodes: " << numBSTNodes); - LDEBUG("Num bricks in tree: " << numBricksTree_); - LDEBUG("Num values per brick: " << numBrickVals_); + LDEBUG(fmt::format("Num OT levels: {}", numOTLevels)); + LDEBUG(fmt::format("Num OT nodes: {}", numOTNodes)); + LDEBUG(fmt::format("Num BST nodes: {}", numBSTNodes)); + LDEBUG(fmt::format("Num bricks in tree: {}", numBricksTree_)); + LDEBUG(fmt::format("Num values per brick: {}", numBrickVals_)); brickSize_ = sizeof(float)*numBrickVals_; volumeSize_ = brickSize_*numBricksFrame_; @@ -110,8 +120,8 @@ bool BrickManager::readHeader() { if (fileSize != calcFileSize) { LERROR("Sizes don't match"); - LERROR("calculated file size: " << calcFileSize); - LERROR("file size: " << fileSize); + LERROR(fmt::format("Calculated file size: {}", calcFileSize)); + LERROR(fmt::format("File size: {}", fileSize)); return false; } diff --git a/modules/multiresvolume/rendering/errorhistogrammanager.cpp b/modules/multiresvolume/rendering/errorhistogrammanager.cpp index c44fbd8380..6e2c8384d5 100644 --- a/modules/multiresvolume/rendering/errorhistogrammanager.cpp +++ b/modules/multiresvolume/rendering/errorhistogrammanager.cpp @@ -33,6 +33,7 @@ #include #include +#include namespace { constexpr const char* _loggerCat = "ErrorHistogramManager"; @@ -62,7 +63,7 @@ bool ErrorHistogramManager::buildHistograms(int numBins) { _numInnerNodes = _tsp->numTotalNodes() - numOtLeaves * numBstLeaves; _histograms = std::vector(_numInnerNodes); - LINFO("Build " << _numInnerNodes << " histograms with " << numBins << " bins each"); + LINFO(fmt::format("Build {} histograms with {} bins each", _numInnerNodes, numBins)); // All TSP Leaves int numOtNodes = _tsp->numOTNodes(); diff --git a/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp b/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp index 273ad34532..a00ee06670 100644 --- a/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp +++ b/modules/multiresvolume/rendering/localerrorhistogrammanager.cpp @@ -33,6 +33,7 @@ #include #include +#include namespace { constexpr const char* _loggerCat = "LocalErrorHistogramManager"; @@ -45,7 +46,7 @@ LocalErrorHistogramManager::LocalErrorHistogramManager(TSP* tsp) : _tsp(tsp) {} LocalErrorHistogramManager::~LocalErrorHistogramManager() {} bool LocalErrorHistogramManager::buildHistograms(int numBins) { - LINFO("Build histograms with " << numBins << " bins each"); + LINFO(fmt::format("Build histograms with {} bins each", numBins)); _numBins = numBins; _file = &(_tsp->file()); @@ -133,7 +134,12 @@ bool LocalErrorHistogramManager::buildFromOctreeChild(unsigned int bstOffset, un if (it != _voxelCache.end()) { childValues = it->second; } else { - LERROR("Child " << childIndex << " visited without cache, " << bstOffset << ", " << octreeOffset); + LERROR(fmt::format( + "Child {} visited without cache, {}, {}", + childIndex, + bstOffset, + octreeOffset + )); return false; } } @@ -147,7 +153,7 @@ bool LocalErrorHistogramManager::buildFromOctreeChild(unsigned int bstOffset, un if (it != _voxelCache.end()) { parentValues = it->second; } else { - LERROR("Parent " << parentIndex << " visited without cache"); + LERROR(fmt::format("Parent {} visited without cache", parentIndex)); return false; } } @@ -218,7 +224,7 @@ bool LocalErrorHistogramManager::buildFromBstChild(unsigned int bstOffset, unsig if (it != _voxelCache.end()) { childValues = it->second; } else { - LERROR("Child " << childIndex << " visited without cache"); + LERROR(fmt::format("Child {} visited without cache", childIndex)); return false; } } @@ -232,7 +238,7 @@ bool LocalErrorHistogramManager::buildFromBstChild(unsigned int bstOffset, unsig if (it != _voxelCache.end()) { parentValues = it->second; } else { - LERROR("Parent " << parentIndex << " visited without cache"); + LERROR(fmt::format("Parent {} visited without cache", parentIndex)); return false; } } diff --git a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp index 0582898d23..2c4defa9fe 100644 --- a/modules/multiresvolume/rendering/renderablemultiresvolume.cpp +++ b/modules/multiresvolume/rendering/renderablemultiresvolume.cpp @@ -194,7 +194,11 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic _filename = ""; bool success = dictionary.getValue(KeyDataSource, _filename); if (!success) { - LERROR("Node '" << name << "' did not contain a valid '" << KeyDataSource << "'"); + LERROR(fmt::format( + "Node '{}' did not contain a valid '{}'", + name, + KeyDataSource + )); return; } _filename = absPath(_filename); @@ -241,7 +245,11 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic _loop = false; } else { _loop = true; - LWARNING("Node " << name << " does not provide valid time information. Viewing one image per frame."); + LWARNING(fmt::format( + "Node '{}' does not provide valid time information. Viewing one image per " + "frame.", + name + )); } @@ -249,8 +257,11 @@ RenderableMultiresVolume::RenderableMultiresVolume (const ghoul::Dictionary& dic _transferFunctionPath = ""; success = dictionary.getValue(KeyTransferFunction, _transferFunctionPath); if (!success) { - LERROR("Node '" << name << "' did not contain a valid '" << - KeyTransferFunction << "'"); + LERROR(fmt::format( + "Node '{}' did not contain a valid '{}'", + name, + KeyTransferFunction + )); return; } _transferFunctionPath = absPath(_transferFunctionPath); @@ -505,18 +516,24 @@ bool RenderableMultiresVolume::initializeSelector() { if (cacheFile.is_open()) { // Read histograms from cache. cacheFile.close(); - LINFO("Loading histograms from cache: " << cacheFilename); + LINFO(fmt::format( + "Loading histograms from cache: {}", + cacheFilename + )); success &= _errorHistogramManager->loadFromFile(cacheFilename); } else if (_errorHistogramsPath != "") { // Read histograms from scene data. - LINFO("Loading histograms from scene data: " << _errorHistogramsPath); + LINFO(fmt::format( + "Loading histograms from scene data: {}", + _errorHistogramsPath + )); success &= _errorHistogramManager->loadFromFile(_errorHistogramsPath); } else { // Build histograms from tsp file. - LWARNING("Failed to open " << cacheFilename); + LWARNING(fmt::format("Failed to open {}", cacheFilename)); success &= _errorHistogramManager->buildHistograms(nHistograms); if (success) { - LINFO("Writing cache to " << cacheFilename); + LINFO(fmt::format("Writing cache to {}", cacheFilename)); _errorHistogramManager->saveToFile(cacheFilename); } } @@ -536,17 +553,17 @@ bool RenderableMultiresVolume::initializeSelector() { if (cacheFile.is_open()) { // Read histograms from cache. cacheFile.close(); - LINFO("Loading histograms from " << cacheFilename); + LINFO(fmt::format("Loading histograms from {}", cacheFilename)); success &= _histogramManager->loadFromFile(cacheFilename); } else { // Build histograms from tsp file. - LWARNING("Failed to open " << cacheFilename); + LWARNING(fmt::format("Failed to open '{}'", cacheFilename)); success &= _histogramManager->buildHistograms( _tsp.get(), nHistograms ); if (success) { - LINFO("Writing cache to " << cacheFilename); + LINFO(fmt::format("Writing cache to {}", cacheFilename)); _histogramManager->saveToFile(cacheFilename); } } @@ -566,14 +583,14 @@ bool RenderableMultiresVolume::initializeSelector() { if (cacheFile.is_open()) { // Read histograms from cache. cacheFile.close(); - LINFO("Loading histograms from " << cacheFilename); + LINFO(fmt::format("Loading histograms from {}", cacheFilename)); success &= _localErrorHistogramManager->loadFromFile(cacheFilename); } else { // Build histograms from tsp file. - LWARNING("Failed to open " << cacheFilename); + LWARNING(fmt::format("Failed to open {}", cacheFilename)); success &= _localErrorHistogramManager->buildHistograms(nHistograms); if (success) { - LINFO("Writing cache to " << cacheFilename); + LINFO(fmt::format("Writing cache to {}", cacheFilename)); _localErrorHistogramManager->saveToFile(cacheFilename); } } diff --git a/modules/multiresvolume/rendering/tsp.cpp b/modules/multiresvolume/rendering/tsp.cpp index f1ef5c2a53..76e1e9402f 100644 --- a/modules/multiresvolume/rendering/tsp.cpp +++ b/modules/multiresvolume/rendering/tsp.cpp @@ -24,12 +24,14 @@ #include +#include #include #include #include #include #include +#include #include #include @@ -119,9 +121,19 @@ bool TSP::readHeader() { file.read(reinterpret_cast(&zNumBricks_), sizeof(unsigned int)); */ - LDEBUG("Grid type: " << _header.gridType_); - LDEBUG("Brick dimensions: " << _header.xBrickDim_ << " " << _header.yBrickDim_ << " " << _header.zBrickDim_); - LDEBUG("Num bricks: " << _header.xNumBricks_ << " " << _header.yNumBricks_ << " " << _header.zNumBricks_); + LDEBUG(fmt::format("Grid type: {}", _header.gridType_)); + LDEBUG(fmt::format( + "Brick dimensions: {} {} {}", + _header.xBrickDim_, + _header.yBrickDim_, + _header.zBrickDim_ + )); + LDEBUG(fmt::format( + "Num bricks: {} {} {}", + _header.xNumBricks_, + _header.yNumBricks_, + _header.zNumBricks_ + )); paddedBrickDim_ = _header.xBrickDim_ + 2 * paddingWidth_; // TODO support dimensions of different size @@ -131,21 +143,20 @@ bool TSP::readHeader() { numBSTNodes_ = static_cast(_header.numTimesteps_ * 2 - 1); numTotalNodes_ = numOTNodes_ * numBSTNodes_; - LDEBUG("Num OT levels: " << numOTLevels_); - LDEBUG("Num OT nodes: " << numOTNodes_); - LDEBUG("Num BST levels: " << numBSTLevels_); - LDEBUG("Num BST nodes: " << numBSTNodes_); - LDEBUG("NUm total nodes: " << numTotalNodes_); + LDEBUG(fmt::format("Num OT levels: {}", numOTLevels_)); + LDEBUG(fmt::format("Num OT nodes: {}", numOTNodes_)); + LDEBUG(fmt::format("Num BST levels: {}", numBSTLevels_)); + LDEBUG(fmt::format("Num BST nodes: {}", numBSTNodes_)); + LDEBUG(fmt::format("Num total nodes: {}", numTotalNodes_)); // Allocate space for TSP structure data_.resize(numTotalNodes_*NUM_DATA); - LDEBUG("data size: " << data_.size()); + LDEBUG(fmt::format("Data size: {}", data_.size())); return true; } bool TSP::construct() { - LDEBUG("Constructing TSP tree"); // Loop over the OTs (one per BST node) @@ -412,9 +423,9 @@ bool TSP::calculateSpatialError() { maxSpatialError_ = maxNorm; medianSpatialError_ = medNorm; - LDEBUG("Min normalized spatial std dev: " << minNorm); - LDEBUG("Max normalized spatial std dev: " << maxNorm); - LDEBUG("Median normalized spatial std dev: " << medNorm); + LDEBUG(fmt::format("Min normalized spatial std dev: {}", minNorm)); + LDEBUG(fmt::format("Max normalized spatial std dev: {}", maxNorm)); + LDEBUG(fmt::format("Median normalized spatial std dev: {}", medNorm)); return true; } @@ -537,16 +548,14 @@ bool TSP::calculateTemporalError() { maxTemporalError_ = maxNorm; medianTemporalError_ = medNorm; - LDEBUG("Min normalized temporal std dev: " << minNorm); - LDEBUG("Max normalized temporal std dev: " << maxNorm); - LDEBUG("Median normalized temporal std dev: " << medNorm); + LDEBUG(fmt::format("Min normalized temporal std dev: {}", minNorm)); + LDEBUG(fmt::format("Max normalized temporal std dev: {}", maxNorm)); + LDEBUG(fmt::format("Median normalized temporal std dev: {}", medNorm)); return true; } - bool TSP::readCache() { - if (!FileSys.cacheManager()) return false; @@ -556,7 +565,7 @@ bool TSP::readCache() { std::ifstream file(cacheFilename, std::ios::in | std::ios::binary); if (!file.is_open()) { - LWARNING("Failed to open " << cacheFilename); + LWARNING(fmt::format("Failed to open {}", cacheFilename)); return false; } @@ -572,18 +581,17 @@ bool TSP::readCache() { file.close(); LDEBUG("Cached errors:"); - LDEBUG("Min spatial error: " << minSpatialError_); - LDEBUG("Max spatial error: " << maxSpatialError_); - LDEBUG("Median spatial error: " << medianSpatialError_); - LDEBUG("Min temporal error: " << minTemporalError_); - LDEBUG("Max temporal error: " << maxTemporalError_); - LDEBUG("Median temporal error: " << medianTemporalError_); + LDEBUG(fmt::format("Min spatial error: {}", minSpatialError_)); + LDEBUG(fmt::format("Max spatial error: {}", maxSpatialError_)); + LDEBUG(fmt::format("Median spatial error: {}", medianSpatialError_)); + LDEBUG(fmt::format("Min temporal error: {}", minTemporalError_)); + LDEBUG(fmt::format("Max temporal error: {}", maxTemporalError_)); + LDEBUG(fmt::format("Median temporal error: {}", medianTemporalError_)); return true; } bool TSP::writeCache() { - if (!FileSys.cacheManager()) return false; @@ -593,10 +601,10 @@ bool TSP::writeCache() { std::ofstream file(cacheFilename, std::ios::out | std::ios::binary); if (!file.is_open()) { - LWARNING("Failed to open " << cacheFilename); + LWARNING(fmt::format("Failed to open {}", cacheFilename)); return false; } - LINFO("Writing cache to " << cacheFilename); + LINFO(fmt::format("Writing cache to {}", cacheFilename)); file.write(reinterpret_cast(&minSpatialError_), sizeof(float)); diff --git a/modules/space/rendering/renderableconstellationbounds.cpp b/modules/space/rendering/renderableconstellationbounds.cpp index 6807553a27..1c8898d62a 100644 --- a/modules/space/rendering/renderableconstellationbounds.cpp +++ b/modules/space/rendering/renderableconstellationbounds.cpp @@ -179,7 +179,7 @@ RenderableConstellationBounds::RenderableConstellationBounds( // The user has specified a constellation name that doesn't exist LWARNINGC( "RenderableConstellationBounds", - "Option '" << s << "' not found in list of constellations" + fmt::format("Option '{}' not found in list of constellations", s) ); } else { @@ -202,7 +202,6 @@ void RenderableConstellationBounds::initializeGL() { absPath("${MODULE_SPACE}/shaders/constellationbounds_fs.glsl") ); - glGenVertexArrays(1, &_vao); glBindVertexArray(_vao); @@ -311,7 +310,11 @@ bool RenderableConstellationBounds::loadVertexFile() { // means that the line was incomplete, so there was an error LERRORC( "RenderableConstellationBounds", - "Error reading file '" << fileName << "' at line #" << currentLineNumber + fmt::format( + "Error reading file '{}' at line #{}", + fileName, + currentLineNumber + ) ); break; } @@ -393,7 +396,7 @@ bool RenderableConstellationBounds::loadConstellationFile() { if (it == _constellationBounds.end()) { LERRORC( "RenderableConstellationBounds", - "Could not find constellation '" << abbreviation << "' in list" + fmt::format("Could not find constellation '{}' in list", abbreviation) ); return false; } diff --git a/modules/space/rendering/renderableplanet.cpp b/modules/space/rendering/renderableplanet.cpp index c1c6ddd5f6..2d5e02a9c5 100644 --- a/modules/space/rendering/renderableplanet.cpp +++ b/modules/space/rendering/renderableplanet.cpp @@ -278,11 +278,12 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary) sourceArray.emplace_back(sourceName, sourceRadius); } else { - LWARNING( - "No Radius value expecified for Shadow Source Name " - << sourceName << " from " << name - << " planet.\nDisabling shadows for this planet." - ); + LWARNING(fmt::format( + "No Radius value specified for Shadow Source Name '{}' from " + "'{}' planet. Disabling shadows for this planet", + sourceName, + name + )); disableShadows = true; break; } @@ -306,9 +307,12 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary) casterArray.emplace_back(casterName, casterRadius); } else { - LWARNING("No Radius value expecified for Shadow Caster Name " - << casterName << " from " << name - << " planet.\nDisabling shadows for this planet."); + LWARNING(fmt::format( + "No Radius value expecified for Shadow Caster Name '{}' from " + "'{}' planet. Disabling shadows for this planet.", + casterName, + name + )); disableShadows = true; break; } @@ -626,7 +630,7 @@ void RenderablePlanet::loadTexture() { _texture->setSwizzleMask({ GL_RED, GL_RED, GL_RED, GL_RED }); } - LDEBUG("Loaded texture from '" << _colorTexturePath << "'"); + LDEBUG(fmt::format("Loaded texture from '{}'", _colorTexturePath.value())); _texture->uploadTexture(); // Textures of planets looks much smoother with AnisotropicMipMap rather than @@ -644,9 +648,14 @@ void RenderablePlanet::loadTexture() { absPath(_nightTexturePath) ); if (_nightTexture) { - LDEBUG("Loaded texture from '" << _nightTexturePath << "'"); + LDEBUG(fmt::format( + "Loaded texture from '{}'", + _nightTexturePath.value() + )); _nightTexture->uploadTexture(); - _nightTexture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); + _nightTexture->setFilter( + ghoul::opengl::Texture::FilterMode::LinearMipMap + ); //_nightTexture->setFilter( // ghoul::opengl::Texture::FilterMode::AnisotropicMipMap //); @@ -661,7 +670,10 @@ void RenderablePlanet::loadTexture() { absPath(_heightMapTexturePath) ); if (_heightMapTexture) { - LDEBUG("Loaded texture from '" << _heightMapTexturePath << "'"); + LDEBUG(fmt::format( + "Loaded texture from '{}'", + _heightMapTexturePath.value() + )); _heightMapTexture->uploadTexture(); _heightMapTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear); //_nightTexture->setFilter( diff --git a/modules/space/rendering/renderablerings.cpp b/modules/space/rendering/renderablerings.cpp index 1c33839775..4046515226 100644 --- a/modules/space/rendering/renderablerings.cpp +++ b/modules/space/rendering/renderablerings.cpp @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include #include @@ -295,7 +295,7 @@ void RenderableRings::loadTexture() { if (texture) { LDEBUGC( "RenderableRings", - "Loaded texture from '" << absPath(_texturePath) << "'" + fmt::format("Loaded texture from '{}'", absPath(_texturePath)) ); _texture = std::move(texture); diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index 5823510146..36b25de8da 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -30,7 +30,8 @@ #include #include -#include +#include +#include #include #include #include @@ -381,11 +382,9 @@ void RenderableStars::update(const UpdateData&) { if (_vao == 0) { glGenVertexArrays(1, &_vao); - LDEBUG("Generating Vertex Array id '" << _vao << "'"); } if (_vbo == 0) { glGenBuffers(1, &_vbo); - LDEBUG("Generating Vertex Buffer Object id '" << _vbo << "'"); } glBindVertexArray(_vao); glBindBuffer(GL_ARRAY_BUFFER, _vbo); @@ -506,9 +505,10 @@ void RenderableStars::update(const UpdateData&) { ); if (_pointSpreadFunctionTexture) { - LDEBUG("Loaded texture from '" << - absPath(_pointSpreadFunctionTexturePath) << "'" - ); + LDEBUG(fmt::format( + "Loaded texture from '{}'", + absPath(_pointSpreadFunctionTexturePath) + )); _pointSpreadFunctionTexture->uploadTexture(); } _pointSpreadFunctionTexture->setFilter( @@ -535,7 +535,10 @@ void RenderableStars::update(const UpdateData&) { absPath(_colorTexturePath) ); if (_colorTexture) { - LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'"); + LDEBUG(fmt::format( + "Loaded texture from '{}'", + absPath(_colorTexturePath) + )); _colorTexture->uploadTexture(); } @@ -574,7 +577,11 @@ bool RenderableStars::loadData() { bool hasCachedFile = FileSys.fileExists(cachedFile); if (hasCachedFile) { - LINFO("Cached file '" << cachedFile << "' used for Speck file '" << _file << "'"); + LINFO(fmt::format( + "Cached file '{}' used for Speck file '{}'", + cachedFile, + _file + )); bool success = loadCachedFile(cachedFile); if (success) { @@ -587,9 +594,9 @@ bool RenderableStars::loadData() { } } else { - LINFO("Cache for Speck file '" << _file << "' not found"); + LINFO(fmt::format("Cache for Speck file '{}' not found", _file)); } - LINFO("Loading Speck file '" << _file << "'"); + LINFO(fmt::format("Loading Speck file '{}'", _file)); bool success = readSpeckFile(); if (!success) { @@ -606,7 +613,7 @@ bool RenderableStars::readSpeckFile() { std::string _file = _speckFile; std::ifstream file(_file); if (!file.good()) { - LERROR("Failed to open Speck file '" << _file << "'"); + LERROR(fmt::format("Failed to open Speck file '{}'", _file)); return false; } @@ -699,7 +706,7 @@ bool RenderableStars::loadCachedFile(const std::string& file) { return success; } else { - LERROR("Error opening file '" << file << "' for loading cache file"); + LERROR(fmt::format("Error opening file '{}' for loading cache file", file)); return false; } } @@ -727,7 +734,7 @@ bool RenderableStars::saveCachedFile(const std::string& file) const { return success; } else { - LERROR("Error opening file '" << file << "' for save cache file"); + LERROR(fmt::format("Error opening file '{}' for save cache file", file)); return false; } } diff --git a/modules/space/translation/spicetranslation.cpp b/modules/space/translation/spicetranslation.cpp index 43b7b87e4e..488659023e 100644 --- a/modules/space/translation/spicetranslation.cpp +++ b/modules/space/translation/spicetranslation.cpp @@ -29,7 +29,7 @@ #include #include #include - +#include #include namespace { diff --git a/modules/space/translation/tletranslation.cpp b/modules/space/translation/tletranslation.cpp index 7399461663..19b4e1bfa8 100644 --- a/modules/space/translation/tletranslation.cpp +++ b/modules/space/translation/tletranslation.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include diff --git a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp index 69ca566143..ea96ec80f0 100644 --- a/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp +++ b/modules/spacecraftinstruments/dashboard/dashboarditeminstruments.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include diff --git a/modules/spacecraftinstruments/rendering/renderablefov.cpp b/modules/spacecraftinstruments/rendering/renderablefov.cpp index eff9c2f308..81dea97f1e 100644 --- a/modules/spacecraftinstruments/rendering/renderablefov.cpp +++ b/modules/spacecraftinstruments/rendering/renderablefov.cpp @@ -384,7 +384,10 @@ void RenderableFov::initializeGL() { } const size_t sizeAfter = res.bounds.size(); - LINFOC(_instrument.name, "Simplified from " << sizeBefore << " to " << sizeAfter); + LINFOC( + _instrument.name, + fmt::format("Simplified from {} to {}", sizeBefore, sizeAfter) + ); } diff --git a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp index b95ffebffa..27043f349c 100644 --- a/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderablemodelprojection.cpp @@ -547,7 +547,7 @@ bool RenderableModelProjection::loadTextures() { absPath(_colorTexturePath) ); if (_baseTexture) { - LDEBUG("Loaded texture from '" << absPath(_colorTexturePath) << "'"); + LDEBUG(fmt::format("Loaded texture from '{}'", absPath(_colorTexturePath))); _baseTexture->uploadTexture(); _baseTexture->setFilter(ghoul::opengl::Texture::FilterMode::LinearMipMap); } diff --git a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp index 2951dcd22f..d5ffe15f1f 100644 --- a/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp +++ b/modules/spacecraftinstruments/rendering/renderableplaneprojection.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include diff --git a/modules/spacecraftinstruments/util/hongkangparser.cpp b/modules/spacecraftinstruments/util/hongkangparser.cpp index 320ce7689f..cb6dcc4e1b 100644 --- a/modules/spacecraftinstruments/util/hongkangparser.cpp +++ b/modules/spacecraftinstruments/util/hongkangparser.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include diff --git a/modules/spacecraftinstruments/util/instrumenttimesparser.cpp b/modules/spacecraftinstruments/util/instrumenttimesparser.cpp index 7241691880..c67b15d7d3 100644 --- a/modules/spacecraftinstruments/util/instrumenttimesparser.cpp +++ b/modules/spacecraftinstruments/util/instrumenttimesparser.cpp @@ -23,6 +23,7 @@ ****************************************************************************************/ #include +#include #include #include #include @@ -40,6 +41,7 @@ #include +#include #include #include #include @@ -97,7 +99,7 @@ bool InstrumentTimesParser::create() { using RawPath = ghoul::filesystem::Directory::RawPath; ghoul::filesystem::Directory sequenceDir(_fileName, RawPath::Yes); if (!FileSys.directoryExists(sequenceDir)) { - LERROR("Could not load Label Directory '" << sequenceDir.path() << "'"); + LERROR(fmt::format("Could not load Label Directory '{}'", sequenceDir.path())); return false; } @@ -110,7 +112,7 @@ bool InstrumentTimesParser::create() { ); if (!FileSys.fileExists(filepath)) { - LERROR("Unable to read file " << filepath << ". Skipping file."); + LERROR(fmt::format("Unable to read file '{}'. Skipping file", filepath)); continue; } diff --git a/modules/spacecraftinstruments/util/labelparser.cpp b/modules/spacecraftinstruments/util/labelparser.cpp index 95939fa481..298568927e 100644 --- a/modules/spacecraftinstruments/util/labelparser.cpp +++ b/modules/spacecraftinstruments/util/labelparser.cpp @@ -30,11 +30,13 @@ #include #include +#include #include #include #include #include +#include #include #include #include @@ -159,7 +161,7 @@ bool LabelParser::create() { using RawPath = ghoul::filesystem::Directory::RawPath; ghoul::filesystem::Directory sequenceDir(_fileName, RawPath::Yes); if (!FileSys.directoryExists(sequenceDir)) { - LERROR("Could not load Label Directory '" << sequenceDir.path() << "'"); + LERROR(fmt::format("Could not load Label Directory '{}'", sequenceDir.path())); return false; } using Recursive = ghoul::filesystem::Directory::Recursive; @@ -173,10 +175,10 @@ bool LabelParser::create() { if (extension == "lbl" || extension == "LBL") { // discovered header file std::ifstream file(currentFile.path()); - if (!file.good()){ - LERROR( - "Failed to open label file '" << currentFile.path() << "'" - ); + if (!file.good()) { + LERROR(fmt::format( + "Failed to open label file '{}'", currentFile.path() + )); return false; } diff --git a/modules/spacecraftinstruments/util/projectioncomponent.cpp b/modules/spacecraftinstruments/util/projectioncomponent.cpp index a33775728f..53e9ba80a2 100644 --- a/modules/spacecraftinstruments/util/projectioncomponent.cpp +++ b/modules/spacecraftinstruments/util/projectioncomponent.cpp @@ -482,7 +482,7 @@ void ProjectionComponent::imageProjectBegin() { glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO); if (_textureSizeDirty) { - LDEBUG("Changing texture size to " << std::to_string(_textureSize)); + LDEBUG(fmt::format("Changing texture size to {}", std::to_string(_textureSize))); // If the texture size has changed, we have to allocate new memory and copy // the image texture to the new target @@ -513,10 +513,11 @@ void ProjectionComponent::imageProjectBegin() { GLenum status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); if (!FramebufferObject::errorChecking(status).empty()) { - LERROR( - "Read Buffer (" << msg << "): " << + LERROR(fmt::format( + "Read Buffer ({}): {}", + msg, FramebufferObject::errorChecking(status) - ); + )); } glFramebufferTexture( @@ -528,10 +529,11 @@ void ProjectionComponent::imageProjectBegin() { status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); if (!FramebufferObject::errorChecking(status).empty()) { - LERROR( - "Draw Buffer (" << msg << "): " << + LERROR(fmt::format( + "Draw Buffer ({}): {}", + msg, FramebufferObject::errorChecking(status) - ); + )); } glBlitFramebuffer( @@ -554,10 +556,11 @@ void ProjectionComponent::imageProjectBegin() { GLenum status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER); if (!FramebufferObject::errorChecking(status).empty()) { - LERROR( - "Read Buffer (" << msg << "): " << + LERROR(fmt::format( + "Read Buffer ({}): {}", + msg, FramebufferObject::errorChecking(status) - ); + )); } glFramebufferTexture( @@ -569,10 +572,11 @@ void ProjectionComponent::imageProjectBegin() { status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); if (!FramebufferObject::errorChecking(status).empty()) { - LERROR( - "Draw Buffer (" << msg << "): " << + LERROR(fmt::format( + "Draw Buffer ({}): {}", + msg, FramebufferObject::errorChecking(status) - ); + )); } glBlitFramebuffer( @@ -985,9 +989,8 @@ std::shared_ptr ProjectionComponent::loadProjectionTextu } bool ProjectionComponent::generateProjectionLayerTexture(const ivec2& size) { - LINFO( - "Creating projection texture of size '" << size.x << ", " << size.y << "'" - ); + LINFO(fmt::format("Creating projection texture of size '{}, {}'", size.x, size.y)); + using namespace ghoul::opengl; _projectionTexture = std::make_unique( glm::uvec3(size, 1), @@ -1033,9 +1036,7 @@ bool ProjectionComponent::generateProjectionLayerTexture(const ivec2& size) { } bool ProjectionComponent::generateDepthTexture(const ivec2& size) { - LINFO( - "Creating depth texture of size '" << size.x << ", " << size.y << "'" - ); + LINFO(fmt::format("Creating depth texture of size '{}, {}'", size.x, size.y)); _shadowing.texture = std::make_unique( glm::uvec3(size, 1), diff --git a/modules/spout/renderableplanespout.cpp b/modules/spout/renderableplanespout.cpp index 0447ea749f..f1cbccd352 100644 --- a/modules/spout/renderableplanespout.cpp +++ b/modules/spout/renderableplanespout.cpp @@ -29,12 +29,14 @@ #include #include -#include +#include #include #include #include namespace { + constexpr const char* LoggerCat = "ScreenSpaceSpout"; + const char* KeyName = "Name"; static const openspace::properties::Property::PropertyInfo NameInfo = { @@ -204,8 +206,8 @@ void RenderablePlaneSpout::update(const UpdateData& data) { if (!createSuccess) { LWARNINGC( - "ScreenSpaceSpout", - "Could not create receiver for " << _currentSenderName + LoggerCat, + fmt::format("Could not create receiver for {}", _currentSenderName) ); return; } @@ -222,8 +224,8 @@ void RenderablePlaneSpout::update(const UpdateData& data) { if (!receiveSuccess && !_isErrorMessageDisplayed) { LWARNINGC( - "ScreenSpaceSpout", - "Could not receive texture for " << _currentSenderName + LoggerCat, + fmt::format("Could not receive texture for {}", _currentSenderName) ); _isErrorMessageDisplayed = true; } diff --git a/modules/spout/screenspacespout.cpp b/modules/spout/screenspacespout.cpp index 2b913088fa..9d738689c3 100644 --- a/modules/spout/screenspacespout.cpp +++ b/modules/spout/screenspacespout.cpp @@ -206,7 +206,7 @@ void ScreenSpaceSpout::update() { if (!createSuccess) { LWARNINGC( "ScreenSpaceSpout", - "Could not create receiver for " << _currentSenderName + fmt::format("Could not create receiver for {}", _currentSenderName) ); return; } @@ -224,7 +224,7 @@ void ScreenSpaceSpout::update() { if (!receiveSuccess && !_isErrorMessageDisplayed) { LWARNINGC( "ScreenSpaceSpout", - "Could not receive texture for " << _currentSenderName + fmt::format("Could not receive texture for {}", _currentSenderName) ); _isErrorMessageDisplayed = true; } diff --git a/modules/sync/syncs/torrentsynchronization.cpp b/modules/sync/syncs/torrentsynchronization.cpp index c2de5b0333..4fbb4d4a4b 100644 --- a/modules/sync/syncs/torrentsynchronization.cpp +++ b/modules/sync/syncs/torrentsynchronization.cpp @@ -32,6 +32,7 @@ #include +#include #include #include diff --git a/modules/sync/tasks/syncassettask.cpp b/modules/sync/tasks/syncassettask.cpp index e79c0142d1..31afbe9fca 100644 --- a/modules/sync/tasks/syncassettask.cpp +++ b/modules/sync/tasks/syncassettask.cpp @@ -139,10 +139,10 @@ void SyncAssetTask::RequestListener::assetStateChanged(std::shared_ptr as Asset::State state) { if (state == Asset::State::LoadingFailed) { - LERROR("Failed to load asset " << asset->id()); + LERROR(fmt::format("Failed to load asset: {}", asset->id())); } if (state == Asset::State::SyncRejected) { - LERROR("Failed to sync asset " << asset->id()); + LERROR(fmt::format("Failed to sync asset: {}", asset->id())); } } diff --git a/modules/sync/torrentclient.cpp b/modules/sync/torrentclient.cpp index 1513fb1728..c3a2f3170e 100644 --- a/modules/sync/torrentclient.cpp +++ b/modules/sync/torrentclient.cpp @@ -46,6 +46,8 @@ #pragma warning (pop) #endif // _MSC_VER +#include + #endif // SYNC_USE_LIBTORRENT namespace { @@ -189,11 +191,11 @@ TorrentClient::TorrentId TorrentClient::addTorrentFile(const std::string& torren p.save_path = destination; p.ti = std::make_shared(torrentFile, ec); if (ec) { - LERROR(torrentFile << ": " << ec.message()); + LERROR(fmt::format("{}: {}", torrentFile, ec.message())); } libtorrent::torrent_handle h = _session.add_torrent(p, ec); if (ec) { - LERROR(torrentFile << ": " << ec.message()); + LERROR(fmt::format("{}: {}", torrentFile, ec.message())); } TorrentId id = h.id(); @@ -219,13 +221,13 @@ TorrentClient::TorrentId TorrentClient::addMagnetLink(const std::string& magnetL libtorrent::error_code ec; libtorrent::add_torrent_params p = libtorrent::parse_magnet_uri(magnetLink, ec); if (ec) { - LERROR(magnetLink << ": " << ec.message()); + LERROR(fmt::format("{}: {}", magnetLink, ec.message())); } p.save_path = destination; p.storage_mode = libtorrent::storage_mode_allocate; libtorrent::torrent_handle h = _session.add_torrent(p, ec); if (ec) { - LERROR(magnetLink << ": " << ec.message()); + LERROR(fmt::format("{}: {}", magnetLink, ec.message())); } TorrentId id = h.id(); diff --git a/modules/touch/src/touchinteraction.cpp b/modules/touch/src/touchinteraction.cpp index d57429921c..736136920f 100644 --- a/modules/touch/src/touchinteraction.cpp +++ b/modules/touch/src/touchinteraction.cpp @@ -46,6 +46,7 @@ #endif #include +#include #include #include @@ -256,18 +257,18 @@ TouchInteraction::TouchInteraction() _origin.onChange([this]() { SceneGraphNode* node = sceneGraphNode(_origin.value()); - if (!node) { - LWARNING( - "Could not find a node in scenegraph called '" << _origin.value() << "'" - ); - return; + if (node) { + setFocusNode(node); + } + else { + LWARNING(fmt::format( + "Could not find a node in scenegraph called '{}'", _origin.value() + )); } - setFocusNode(node); }); levmarq_init(&_lmstat); - _time.initSession(); } @@ -319,12 +320,12 @@ bool TouchInteraction::guiMode(const std::vector& list) { _guiON = !_guiON; module.gui.setEnabled(_guiON); - std::string mode = (_guiON) ? "" : "de"; - LINFO( - "GUI mode is " << mode << "activated. Inside box by: (" << - static_cast(100 * (pos.x / _guiButton.value().x)) << "%, " << - static_cast(100 * (pos.y / _guiButton.value().y)) << "%)\n" - ); + LINFO(fmt::format( + "GUI mode is {}. Inside box by: ({}%, {}%)", + _guiON ? "activated" : "deactivated", + static_cast(100 * (pos.x / _guiButton.value().x)), + static_cast(100 * (pos.y / _guiButton.value().y)) + )); } else if (_guiON) { module.touchInput = { _guiON, pos, 1 }; // emulate touch input as a mouse diff --git a/modules/touch/src/tuioear.cpp b/modules/touch/src/tuioear.cpp index 79eb78f8c6..326a9ffc55 100644 --- a/modules/touch/src/tuioear.cpp +++ b/modules/touch/src/tuioear.cpp @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/modules/touch/touchmodule.cpp b/modules/touch/touchmodule.cpp index 20723e0a70..bae93f2a40 100644 --- a/modules/touch/touchmodule.cpp +++ b/modules/touch/touchmodule.cpp @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/modules/volume/rendering/renderabletimevaryingvolume.cpp b/modules/volume/rendering/renderabletimevaryingvolume.cpp index ea48521273..6cba240b7b 100644 --- a/modules/volume/rendering/renderabletimevaryingvolume.cpp +++ b/modules/volume/rendering/renderabletimevaryingvolume.cpp @@ -23,9 +23,9 @@ ****************************************************************************************/ #include + #include #include - #include #include #include @@ -34,13 +34,12 @@ #include #include #include - #include #include #include #include #include - +#include #include namespace { @@ -222,7 +221,7 @@ void RenderableTimeVaryingVolume::initializeGL() { ghoul::filesystem::Directory sequenceDir(_sourceDirectory, RawPath::Yes); if (!FileSys.directoryExists(sequenceDir)) { - LERROR("Could not load sequence directory '" << sequenceDir.path() << "'"); + LERROR(fmt::format("Could not load sequence directory '{}'", sequenceDir.path())); return; } @@ -340,16 +339,11 @@ void RenderableTimeVaryingVolume::initializeGL() { void RenderableTimeVaryingVolume::loadTimestepMetadata(const std::string& path) { ghoul::Dictionary dictionary = ghoul::lua::loadDictionaryFromFile(path); - try { - documentation::testSpecificationAndThrow( - TimestepDocumentation(), - dictionary, - "TimeVaryingVolumeTimestep" - ); - } catch (const documentation::SpecificationError& e) { - LERROR(e.message << e.component); - return; - } + documentation::testSpecificationAndThrow( + TimestepDocumentation(), + dictionary, + "TimeVaryingVolumeTimestep" + ); Timestep t; t.baseName = ghoul::filesystem::File(path).baseName(); diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index d6304dace4..3a68648e32 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -36,7 +36,7 @@ #include #include -#include +#include namespace { const char* MainTemplateFilename = "${WEB}/documentation/main.hbs"; diff --git a/src/engine/configurationmanager.cpp b/src/engine/configurationmanager.cpp index 85f0ad04eb..aedf5a1799 100644 --- a/src/engine/configurationmanager.cpp +++ b/src/engine/configurationmanager.cpp @@ -26,6 +26,8 @@ #include +#include +#include #include #include #include @@ -188,11 +190,16 @@ void ConfigurationManager::loadFromFile(const string& filename) { std::string p = dictionary.value(key); std::string fullKey = FileSystem::TokenOpeningBraces + key + FileSystem::TokenClosingBraces; - LDEBUGC("ConfigurationManager", "Registering path " << fullKey << ": " << p); + LDEBUGC("ConfigurationManager", + fmt::format("Registering path {}: {}", fullKey, p) + ); bool override = (basePathToken == fullKey); if (override) { - LINFOC("ConfigurationManager", "Overriding base path with '" << p << "'"); + LINFOC( + "ConfigurationManager", + fmt::format("Overriding base path with '{}'", p) + ); } using Override = ghoul::filesystem::FileSystem::Override; diff --git a/src/engine/downloadmanager.cpp b/src/engine/downloadmanager.cpp index 784d3ca8ad..d594a0218d 100644 --- a/src/engine/downloadmanager.cpp +++ b/src/engine/downloadmanager.cpp @@ -24,6 +24,7 @@ #include +#include #include #include #include @@ -239,7 +240,7 @@ std::future DownloadManager::fetchFile( const std::string& url, SuccessCallback successCallback, ErrorCallback errorCallback) { - LDEBUG("Start downloading file: '" << url << "' into memory"); + LDEBUG(fmt::format("Start downloading file: '{}' into memory", url)); auto downloadFunction = [url, successCallback, errorCallback]() { DownloadManager::MemoryFile file; @@ -284,7 +285,7 @@ std::future DownloadManager::fetchFile( if (errorCallback) { errorCallback(err); } else { - LWARNING("Error downloading '" << url << "': " << err); + LWARNING(fmt::format("Error downloading '{}': {}", url, err)); } curl_easy_cleanup(curl); // Throw an error and use try-catch around call to future.get() diff --git a/src/engine/moduleengine.cpp b/src/engine/moduleengine.cpp index bc69689c65..f0f7f0223e 100644 --- a/src/engine/moduleengine.cpp +++ b/src/engine/moduleengine.cpp @@ -60,7 +60,7 @@ void ModuleEngine::initialize(const ghoul::Dictionary& moduleConfigurations) { void ModuleEngine::deinitialize() { LDEBUG("Deinitializing modules"); for (auto& m : _modules) { - LDEBUG("Deinitializing module '" << m->name() << "'"); + LDEBUG(fmt::format("Deinitializing module '{}'", m->name())); m->deinitialize(); } _modules.clear(); @@ -86,10 +86,10 @@ void ModuleEngine::registerModule(std::unique_ptr m, ); } - LDEBUG("Registering module '" << m->name() << "'"); + LDEBUG(fmt::format("Registering module '{}'", m->name())); m->initialize(this, configuration); addPropertySubOwner(m.get()); - LDEBUG("Registered module '" << m->name() << "'"); + LDEBUG(fmt::format("Registered module '{}'", m->name())); _modules.push_back(std::move(m)); } diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 8c198ef516..4fb984ac3f 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -80,7 +80,10 @@ #include #include #include -#include +#include +#include +#include +#include #include @@ -313,7 +316,7 @@ void OpenSpaceEngine::create(int argc, char** argv, "Configuration file '" + configurationFilePath + "'" ); } - LINFO("Configuration Path: '" << configurationFilePath << "'"); + LINFO(fmt::format("Configuration Path: '{}'", configurationFilePath)); // Loading configuration from disk LDEBUG("Loading configuration from disk"); @@ -321,7 +324,9 @@ void OpenSpaceEngine::create(int argc, char** argv, _engine->configurationManager().loadFromFile(configurationFilePath); } catch (const documentation::SpecificationError& e) { - LFATAL("Loading of configuration file '" << configurationFilePath << "' failed"); + LFATAL(fmt::format( + "Loading of configuration file '{}' failed", configurationFilePath + )); for (const documentation::TestResult::Offense& o : e.result.offenses) { LERRORC(o.offender, std::to_string(o.reason)); } @@ -331,7 +336,9 @@ void OpenSpaceEngine::create(int argc, char** argv, throw; } catch (const ghoul::RuntimeError& e) { - LFATAL("Loading of configuration file '" << configurationFilePath << "' failed"); + LFATAL(fmt::format( + "Loading of configuration file '{}' failed", configurationFilePath + )); LFATALC(e.component, e.message); throw; } @@ -352,8 +359,8 @@ void OpenSpaceEngine::create(int argc, char** argv, cacheFolder += "-" + ghoul::filesystem::File(scene).baseName(); } - LINFO("Old cache: " << absPath("${CACHE}")); - LINFO("New cache: " << cacheFolder); + LINFO(fmt::format("Old cache: {}", absPath("${CACHE}"))); + LINFO(fmt::format("New cache: {}", cacheFolder)); FileSys.registerPathToken( "${CACHE}", cacheFolder, @@ -415,8 +422,10 @@ void OpenSpaceEngine::create(int argc, char** argv, ConfigurationManager::KeyConfigSgct, sgctConfigurationPath); if (!commandlineArgumentPlaceholders.sgctConfigurationName.empty()) { - LDEBUG("Overwriting SGCT configuration file with commandline argument: " << - commandlineArgumentPlaceholders.sgctConfigurationName); + LDEBUG(fmt::format( + "Overwriting SGCT configuration file with commandline argument: {}", + commandlineArgumentPlaceholders.sgctConfigurationName + )); sgctConfigurationPath = commandlineArgumentPlaceholders.sgctConfigurationName; } @@ -520,7 +529,7 @@ void OpenSpaceEngine::initialize() { // Check the required OpenGL versions of the registered modules ghoul::systemcapabilities::Version version = _engine->_moduleEngine->requiredOpenGLVersion(); - LINFO("Required OpenGL version: " << std::to_string(version)); + LINFO(fmt::format("Required OpenGL version: {}", std::to_string(version))); if (OpenGLCap.openGLVersion() < version) { throw ghoul::RuntimeError( @@ -854,14 +863,14 @@ void OpenSpaceEngine::runGlobalCustomizationScripts() { if (FileSys.fileExists(script)) { try { - LINFO("Running global customization script: " << script); + LINFO(fmt::format("Running global customization script: {}", script)); ghoul::lua::runScriptFile(state, script); } catch (ghoul::RuntimeError& e) { LERRORC(e.component, e.message); } } else { - LDEBUG("Ignoring non-existing script file: " << script); + LDEBUG(fmt::format("Ignoring non-existing script file: {}", script)); } } } @@ -877,15 +886,15 @@ void OpenSpaceEngine::loadFonts() { std::string font = absPath(fonts.value(key)); if (!FileSys.fileExists(font)) { - LERROR("Could not find font '" << font << "'"); + LERROR(fmt::format("Could not find font '{}'", font)); continue; } - LDEBUG("Registering font '" << font << "' with key '" << key << "'"); + LDEBUG(fmt::format("Registering font '{}' with key '{}'", font, key)); bool success = _fontManager->registerFontPath(key, font); if (!success) { - LERROR("Error registering font '" << font << "' with key '" << key << "'"); + LERROR(fmt::format("Error registering font '{}' with key '{}'", font, key)); } } @@ -1145,38 +1154,40 @@ void OpenSpaceEngine::initializeGL() { case GL_INVALID_ENUM: LERRORC( "OpenGL Invalid State", - "Function " << f.toString() << ": GL_INVALID_ENUM" + fmt::format("Function {}: GL_INVALID_ENUM", f.toString()) ); break; case GL_INVALID_VALUE: LERRORC( "OpenGL Invalid State", - "Function " << f.toString() << ": GL_INVALID_VALUE" + fmt::format("Function {}: GL_INVALID_VALUE", f.toString()) ); break; case GL_INVALID_OPERATION: LERRORC( "OpenGL Invalid State", - "Function " << f.toString() << ": GL_INVALID_OPERATION" + fmt::format("Function {}: GL_INVALID_OPERATION", f.toString()) ); break; case GL_INVALID_FRAMEBUFFER_OPERATION: LERRORC( "OpenGL Invalid State", - "Function " << f.toString() << - ": GL_INVALID_FRAMEBUFFER_OPERATION" + fmt::format( + "Function {}: GL_INVALID_FRAMEBUFFER_OPERATION", + f.toString() + ) ); break; case GL_OUT_OF_MEMORY: LERRORC( "OpenGL Invalid State", - "Function " << f.toString() << ": GL_OUT_OF_MEMORY" + fmt::format("Function {}: GL_OUT_OF_MEMORY", f.toString()) ); break; default: LERRORC( "OpenGL Invalid State", - "Unknown error code: " << std::hex << error + fmt::format("Unknown error code: {0:x}", error) ); } }); @@ -1193,19 +1204,22 @@ void OpenSpaceEngine::initializeGL() { setCallbackMask(CallbackMask::After | CallbackMask::ParametersAndReturnValue); glbinding::setAfterCallback([](const glbinding::FunctionCall& call) { std::string arguments = std::accumulate( - call.parameters.begin(), - call.parameters.end(), - std::string("("), - [](std::string a, AbstractValue* v) { - return a + ", " + v->asString(); - } + call.parameters.begin(), + call.parameters.end(), + std::string("("), + [](std::string a, AbstractValue* v) { + return a + ", " + v->asString(); + } ); std::string returnValue = call.returnValue ? " -> " + call.returnValue->asString() : ""; - LTRACEC("OpenGL", call.function->name() << arguments << returnValue); + LTRACEC( + "OpenGL", + call.function->name() + arguments + returnValue + ); }); } } @@ -1236,7 +1250,7 @@ void OpenSpaceEngine::preSynchronization() { FileSys.triggerFilesystemEvents(); if (_hasScheduledAssetLoading) { - LINFO("Loading asset: " << _scheduledAssetPathToLoad); + LINFO(fmt::format("Loading asset: {}", _scheduledAssetPathToLoad)); loadSingleAsset(_scheduledAssetPathToLoad); _hasScheduledAssetLoading = false; _scheduledAssetPathToLoad = ""; @@ -1288,7 +1302,7 @@ void OpenSpaceEngine::postSynchronizationPreDraw() { perf = std::make_unique( "OpenSpaceEngine::postSynchronizationPreDraw", OsEng.renderEngine().performanceManager() - ); + ); } bool master = _windowWrapper->isMaster(); @@ -1329,13 +1343,13 @@ void OpenSpaceEngine::postSynchronizationPreDraw() { int fatalCounter = LogMgr.messageCounter(LogLevel::Fatal); if (warningCounter > 0) { - LWARNINGC("Logging", "Number of Warnings raised: " << warningCounter); + LWARNINGC("Logging", fmt::format("Number of Warnings: {}", warningCounter)); } if (errorCounter > 0) { - LWARNINGC("Logging", "Number of Errors raised: " << errorCounter); + LWARNINGC("Logging", fmt::format("Number of Errors: {}", errorCounter)); } if (fatalCounter > 0) { - LWARNINGC("Logging", "Number of Fatals raised: " << fatalCounter); + LWARNINGC("Logging", fmt::format("Number of Fatals: {}", fatalCounter)); } LogMgr.resetMessageCounters(); @@ -1545,8 +1559,8 @@ scripting::LuaLibrary OpenSpaceEngine::luaLibrary() { "addVirtualProperty", &luascriptfunctions::addVirtualProperty, {}, - "type, name, identifier, description," - "[value, minimumValue, maximumValue]", + "type, name, identifier," + "[description, value, minimumValue, maximumValue]", "Adds a virtual property that will set a group of properties" }, { diff --git a/src/engine/openspaceengine_lua.inl b/src/engine/openspaceengine_lua.inl index 276b5f2afb..081e4be3cc 100644 --- a/src/engine/openspaceengine_lua.inl +++ b/src/engine/openspaceengine_lua.inl @@ -141,7 +141,15 @@ int removeVirtualProperty(lua_State* L) { const std::string name = lua_tostring(L, -1); lua_settop(L, 0); properties::Property* p = OsEng.virtualPropertyManager().property(name); - OsEng.virtualPropertyManager().removeProperty(p); + if (p) { + OsEng.virtualPropertyManager().removeProperty(p); + } + else { + LWARNINGC( + "removeVirtualProperty", + fmt::format("Virtual Property with name {} did not exist", name) + ); + } ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); return 0; } @@ -233,7 +241,7 @@ int downloadFile(lua_State* L) { lua_settop(L, 0); const std::string _loggerCat = "OpenSpaceEngine"; - LINFO("Downloading file from " << uri); + LINFO(fmt::format("Downloading file from {}", uri)); DownloadManager dm = openspace::DownloadManager(false); std::shared_ptr future = dm.downloadFile(uri, absPath("${SCENE}/" + savePath), true, true, 5); diff --git a/src/interaction/keybindingmanager_lua.inl b/src/interaction/keybindingmanager_lua.inl index 6dfece8285..38bdb9b17b 100644 --- a/src/interaction/keybindingmanager_lua.inl +++ b/src/interaction/keybindingmanager_lua.inl @@ -50,7 +50,7 @@ int bindKey(lua_State* L) { openspace::KeyWithModifier iKey = openspace::stringToKey(key); if (iKey.key == openspace::Key::Unknown) { - LERRORC("lua.bindKey", "Could not find key '"<< key << "'"); + LERRORC("lua.bindKey", fmt::format("Could not find key '{}'", key)); return 0; } @@ -96,7 +96,7 @@ int bindKeyLocal(lua_State* L) { openspace::KeyWithModifier iKey = openspace::stringToKey(key); if (iKey.key == openspace::Key::Unknown) { - LERRORC("lua.bindKey", "Could not find key '" << key << "'"); + LERRORC("lua.bindKey", fmt::format("Could not find key '{}'", key)); return 0; } diff --git a/src/interaction/luaconsole.cpp b/src/interaction/luaconsole.cpp index 180ef6ba37..50c232c23d 100644 --- a/src/interaction/luaconsole.cpp +++ b/src/interaction/luaconsole.cpp @@ -198,7 +198,7 @@ void LuaConsole::initialize() { if (version != CurrentVersion) { LWARNINGC( "LuaConsole", - "Outdated console history version: " << version + fmt::format("Outdated console history version: {}", version) ); } else { diff --git a/src/interaction/navigationhandler.cpp b/src/interaction/navigationhandler.cpp index dbe74a635c..59e5298af6 100644 --- a/src/interaction/navigationhandler.cpp +++ b/src/interaction/navigationhandler.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -80,9 +81,9 @@ NavigationHandler::NavigationHandler() SceneGraphNode* node = sceneGraphNode(_origin.value()); if (!node) { - LWARNING( - "Could not find a node in scenegraph called '" << _origin.value() << "'" - ); + LWARNING(fmt::format( + "Could not find a node in scenegraph called '{}'", _origin.value() + )); return; } setFocusNode(node); @@ -248,7 +249,7 @@ ghoul::Dictionary NavigationHandler::getCameraStateDictionary() { void NavigationHandler::saveCameraStateToFile(const std::string& filepath) { if (!filepath.empty()) { std::string fullpath = absPath(filepath); - LINFO("Saving camera position: " << filepath); + LINFO(fmt::format("Saving camera position: {}", filepath)); ghoul::Dictionary cameraDict = getCameraStateDictionary(); @@ -279,7 +280,7 @@ void NavigationHandler::saveCameraStateToFile(const std::string& filepath) { } void NavigationHandler::restoreCameraStateFromFile(const std::string& filepath) { - LINFO("Reading camera state from file: " << filepath); + LINFO(fmt::format("Reading camera state from file: {}", filepath)); if (!FileSys.fileExists(filepath)) throw ghoul::FileNotFoundError(filepath, "CameraFilePath"); diff --git a/src/mission/mission.cpp b/src/mission/mission.cpp index 1f7fb1da25..ad9795fc3e 100644 --- a/src/mission/mission.cpp +++ b/src/mission/mission.cpp @@ -26,6 +26,7 @@ #include +#include #include #include diff --git a/src/mission/missionmanager.cpp b/src/mission/missionmanager.cpp index 3dc66b4e2b..ca38c88c84 100644 --- a/src/mission/missionmanager.cpp +++ b/src/mission/missionmanager.cpp @@ -24,6 +24,7 @@ #include +#include #include #include #include diff --git a/src/network/networkengine.cpp b/src/network/networkengine.cpp index fc250462af..9cd1097094 100644 --- a/src/network/networkengine.cpp +++ b/src/network/networkengine.cpp @@ -84,7 +84,7 @@ bool NetworkEngine::handleMessage(const std::string& message) { return true; } default: - LERROR("Unknown type '" << type << "'"); + LERROR(fmt::format("Unknown type '{}'", type)); return false; } } @@ -217,9 +217,9 @@ void NetworkEngine::sendInitialInformation() { std::vector payload = m.body; payload.insert(payload.begin(), identifier.data.begin(), identifier.data.end()); OsEng.windowWrapper().sendMessageToExternalControl(payload); - LINFO("Sent initial message: (s=" << m.body.size() << ")" << - "[i=" << identifier.value << "]" - ); + LINFO(fmt::format( + "Sent initial message: (s={}) [i={}]", m.body.size(), identifier.value + )); std::this_thread::sleep_for(std::chrono::milliseconds(SleepTime)); } diff --git a/src/network/parallelconnection.cpp b/src/network/parallelconnection.cpp index b8672de32b..153aeb781f 100644 --- a/src/network/parallelconnection.cpp +++ b/src/network/parallelconnection.cpp @@ -400,7 +400,10 @@ void ParallelConnection::establishConnection(addrinfo *info) { sizeof(int) ); if (result == SOCKET_ERROR) { - LERROR("Failed to set socket option 'reuse address'. Error code: " << _ERRNO); + LERROR(fmt::format( + "Failed to set socket option 'reuse address'. Error code: {}", + _ERRNO + )); } result = setsockopt( @@ -411,17 +414,27 @@ void ParallelConnection::establishConnection(addrinfo *info) { sizeof(int) ); if (result == SOCKET_ERROR) { - LERROR("Failed to set socket option 'keep alive'. Error code: " << _ERRNO); + LERROR(fmt::format( + "Failed to set socket option 'keep alive'. Error code: {}", + _ERRNO + )); } - LINFO("Attempting to connect to server "<< _address << " on port " << _port); + LINFO(fmt::format( + "Attempting to connect to server {} on port {}", + _address.value(), + _port.value() + )); // Try to connect result = connect(_clientSocket, info->ai_addr, static_cast(info->ai_addrlen)); // If the connection was successfull if (result != SOCKET_ERROR) { - LINFO("Connection established with server at ip: "<< _address); + LINFO(fmt::format( + "Connection established with server at ip: {}", + _address.value() + )); // We're connected _isConnected = true; @@ -677,9 +690,10 @@ void ParallelConnection::dataMessageReceived(const std::vector& messageCon break; } default: { - LERROR("Unidentified data message with identifier " << type << - " received in parallel connection." - ); + LERROR(fmt::format( + "Unidentified message with identifier {} received in parallel connection", + type + )); break; } } @@ -761,10 +775,11 @@ void ParallelConnection::sendFunc() { ); if (result == SOCKET_ERROR) { - LERROR( - "Failed to send message.\nError: " << - _ERRNO << " detected in connection, disconnecting." - ); + LERROR(fmt::format( + "Failed to send message. Error {} detected in connection" + "; disconnecting", + _ERRNO + )); signalDisconnect(); } @@ -941,10 +956,10 @@ void ParallelConnection::listenCommunication() { // If enough data was received if (nBytesRead <= 0) { if (!_disconnect) { - LERROR( - "Error " << _ERRNO << - " detected in connection when reading header, disconnecting!" - ); + LERROR(fmt::format( + "Error {} detected in connection when reader header; disconnecting!", + _ERRNO + )); signalDisconnect(); } break; @@ -964,10 +979,11 @@ void ParallelConnection::listenCommunication() { uint32_t messageSizeIn = *(ptr++); if (protocolVersionIn != ProtocolVersion) { - LERROR( - "Protocol versions do not match. Server version: " << - protocolVersionIn << ", Client version: " << ProtocolVersion - ); + LERROR(fmt::format( + "Protocol versions do not match. Server version: {}, Client version: {}", + protocolVersionIn, + ProtocolVersion + )); signalDisconnect(); break; } @@ -985,9 +1001,10 @@ void ParallelConnection::listenCommunication() { if (nBytesRead <= 0) { if (!_disconnect) { - LERROR( - "Error " << _ERRNO << - " detected in connection when reading message, disconnecting!"); + LERROR(fmt::format( + "Error {} detected in connection when reading message; disconnecting", + _ERRNO + )); signalDisconnect(); } break; diff --git a/src/performance/performancemanager.cpp b/src/performance/performancemanager.cpp index c8aa7093e5..c5f49f89c0 100644 --- a/src/performance/performancemanager.cpp +++ b/src/performance/performancemanager.cpp @@ -36,6 +36,7 @@ #include #include #include +#include namespace { constexpr const char* _loggerCat = "PerformanceManager"; @@ -78,10 +79,11 @@ void PerformanceManager::createGlobalSharedMemory() { sharedMemory.acquireLock(); GlobalMemory* m = reinterpret_cast(sharedMemory.memory()); ++(m->referenceCount); - LINFO( + LINFO(fmt::format( "Using global shared memory block for performance measurements. " - "Reference count: " << int(m->referenceCount) - ); + "Reference count: {}", + int(m->referenceCount) + )); sharedMemory.releaseLock(); } else { @@ -110,7 +112,10 @@ void PerformanceManager::destroyGlobalSharedMemory() { sharedMemory.acquireLock(); GlobalMemory* m = reinterpret_cast(sharedMemory.memory()); --(m->referenceCount); - LINFO("Global shared performance memory reference count: " << int(m->referenceCount)); + LINFO(fmt::format( + "Global shared performance memory reference count: {}", + int(m->referenceCount) + )); if (m->referenceCount == 0) { LINFO("Removing global shared performance memory"); @@ -120,7 +125,7 @@ void PerformanceManager::destroyGlobalSharedMemory() { for (int i = 0; i < std::numeric_limits::max(); ++i) { std::string localName = LocalSharedMemoryNameBase + std::to_string(i); if (SharedMemory::exists(localName)) { - LINFO("Removing shared memory: " << localName); + LINFO(fmt::format("Removing shared memory: {}", localName)); SharedMemory::remove(localName); } } @@ -156,7 +161,11 @@ PerformanceManager::PerformanceManager(std::string loggingDirectory, std::string // Compute the total size const int totalSize = sizeof(PerformanceLayout); - LINFO("Create shared memory '" + localName + "' of " << totalSize << " bytes"); + LINFO(fmt::format( + "Create shared memory '{}' of {} bytes", + localName, + totalSize + )); if (ghoul::SharedMemory::exists(localName)) { throw ghoul::RuntimeError( @@ -183,7 +192,7 @@ PerformanceManager::~PerformanceManager() { --(m->number); sharedMemory.releaseLock(); - LINFO("Remove shared memory '" << _performanceMemory->name() << "'"); + LINFO(fmt::format("Remove shared memory '{}'", _performanceMemory->name())); ghoul::SharedMemory::remove(_performanceMemory->name()); _performanceMemory = nullptr; @@ -321,7 +330,7 @@ bool PerformanceManager::createLogDir() { FileSys.createDirectory(dir, ghoul::filesystem::FileSystem::Recursive::Yes); } catch (const ghoul::filesystem::FileSystem::FileSystemException& e) { - LERROR("Could not create log directory: " << e.message); + LERROR(fmt::format("Could not create log directory: {}", e.message)); return false; } return true; diff --git a/src/properties/optionproperty.cpp b/src/properties/optionproperty.cpp index 874caa07ef..752bae34d8 100644 --- a/src/properties/optionproperty.cpp +++ b/src/properties/optionproperty.cpp @@ -60,9 +60,12 @@ void OptionProperty::addOption(int value, std::string desc) { for (const Option& o : _options) { if (o.value == option.value) { - LWARNING("The value of option {" << o.value << " -> " << o.description << - "} was already registered when trying to add option {" << option.value << - " -> " << option.description << "}"); + LWARNING(fmt::format( + "The value of option {{ {} -> {} }} was already registered when trying " + "to add option {{ {} -> {} }}", + o.value, o.description, option.value, option.description + + )); return; } } @@ -92,7 +95,7 @@ void OptionProperty::setValue(int value) { } // Otherwise, log an error - LERROR("Could not find an option for value '" << value << "' in OptionProperty"); + LERROR(fmt::format("Could not find an option for value '{}'", value)); } bool OptionProperty::hasOption() const { diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp index 9bd16dcdc9..d7a4e21729 100644 --- a/src/properties/propertyowner.cpp +++ b/src/properties/propertyowner.cpp @@ -25,9 +25,9 @@ #include #include +#include #include #include - #include #include @@ -174,15 +174,20 @@ void PropertyOwner::addProperty(Property* prop) { // If we found the property identifier, we need to bail out if (it != _properties.end() && (*it)->identifier() == prop->identifier()) { - LERROR("Property identifier '" << prop->identifier() << - "' already present in PropertyOwner '" << name() << "'"); + LERROR(fmt::format( + "Property identifier '{}' already present in PropertyOwner '{}'", + prop->identifier(), + name() + )); return; } else { // Otherwise we still have to look if there is a PropertyOwner with the same name const bool hasOwner = hasPropertySubOwner(prop->identifier()); if (hasOwner) { - LERROR("Property identifier '" << prop->identifier() << "' already names a " - << "registed PropertyOwner"); + LERROR(fmt::format( + "Property identifier '{}' already names a registered PropertyOwner", + prop->identifier() + )); return; } else { @@ -209,15 +214,19 @@ void PropertyOwner::addPropertySubOwner(openspace::properties::PropertyOwner* ow // If we found the propertyowner's name, we need to bail out if (it != _subOwners.end() && (*it)->name() == owner->name()) { - LERROR("PropertyOwner '" << owner->name() << - "' already present in PropertyOwner '" << name() << "'"); + LERROR(fmt::format( + "PropertyOwner '{}' already present in PropertyOwner '{}'", + owner->name(), + name() + )); return; } else { // We still need to check if the PropertyOwners name is used in a Property const bool hasProp = hasProperty(owner->name()); if (hasProp) { - LERROR("PropertyOwner '" << owner->name() << "'s name already names a " - << "Property"); + LERROR(fmt::format( + "PropertyOwner '{}'s name already names a Property", owner->name() + )); return; } else { @@ -246,8 +255,9 @@ void PropertyOwner::removeProperty(Property* prop) { (*it)->setPropertyOwner(nullptr); _properties.erase(it); } else { - LERROR("Property with identifier '" << prop->identifier() << - "' not found for removal."); + LERROR(fmt::format( + "Property with identifier '{}' not found for removal", prop->identifier() + )); } } @@ -269,8 +279,9 @@ void PropertyOwner::removePropertySubOwner(openspace::properties::PropertyOwner* if (it != _subOwners.end() && (*it)->name() == owner->name()) { _subOwners.erase(it); } else { - LERROR("PropertyOwner with name '" << owner->name() << - "' not found for removal."); + LERROR(fmt::format( + "PropertyOwner with name '{}' not found for removal", owner->name() + )); } } diff --git a/src/properties/selectionproperty.cpp b/src/properties/selectionproperty.cpp index 00e4b0b321..34f94969ec 100644 --- a/src/properties/selectionproperty.cpp +++ b/src/properties/selectionproperty.cpp @@ -46,9 +46,10 @@ void SelectionProperty::addOption(Option option) { if (o.value == option.value) { LWARNINGC( "SelectionProperty", - "The value of option {" << o.value << " -> " << o.description << - "} was already registered when trying to add option {" << option.value << - " -> " << option.description << "}" + fmt::format("The value of option {{ {} -> {} }} was already registered " + "when trying to add option {{ {} -> {} }}", + o.value, o.description, option.value, option.description + ) ); return; } diff --git a/src/rendering/abufferrenderer.cpp b/src/rendering/abufferrenderer.cpp index 7cf0de7b5f..0545a6a664 100644 --- a/src/rendering/abufferrenderer.cpp +++ b/src/rendering/abufferrenderer.cpp @@ -951,10 +951,11 @@ void ABufferRenderer::updateRaycastData() { for (auto &raycaster : raycasters) { if (nextId > MaxRaycasters) { int nIgnored = MaxRaycasters - static_cast(raycasters.size()); - LWARNING( - "ABufferRenderer does not support more than 32 raycasters. " << - "Ignoring " << nIgnored << " raycasters" - ); + LWARNING(fmt::format( + "ABufferRenderer does not support more than 32 raycasters. " + "Ignoring {} raycasters", + nIgnored + )); break; } diff --git a/src/rendering/renderable.cpp b/src/rendering/renderable.cpp index 6ab6e314c4..7ddd86c41a 100644 --- a/src/rendering/renderable.cpp +++ b/src/rendering/renderable.cpp @@ -95,11 +95,6 @@ std::unique_ptr Renderable::createFromDictionary( auto factory = FactoryManager::ref().factory(); ghoul_assert(factory, "Renderable factory did not exist"); std::unique_ptr result = factory->create(renderableType, dictionary); - if (result == nullptr) { - LERROR("Failed to create a Renderable object of type '" << renderableType << "'"); - return nullptr; - } - return result; } diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 18cb13d7f4..84e96a158a 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -341,8 +341,7 @@ void RenderEngine::setRendererFromString(const std::string& renderingMethod) { newRenderer = std::make_unique(); break; case RendererImplementation::Invalid: - LFATAL("Rendering method '" << renderingMethod << "' not among the available " - << "rendering methods"); + LFATAL(fmt::format("Rendering method '{}' not available", renderingMethod)); } setRenderer(std::move(newRenderer)); @@ -384,7 +383,7 @@ void RenderEngine::initialize() { _deferredcasterManager = std::make_unique(); _nAaSamples = OsEng.windowWrapper().currentNumberOfAaSamples(); - LINFO("Setting renderer from string: " << renderingMethod); + LINFO(fmt::format("Setting renderer from string: {}", renderingMethod)); setRendererFromString(renderingMethod); #ifdef GHOUL_USE_DEVIL @@ -689,6 +688,16 @@ void RenderEngine::postDraw() { } if (_shouldTakeScreenshot) { + // We only create the directory here, as we don't want to spam the users + // screenshot folder everytime we start OpenSpace even when we are not taking any + // screenshots. So the first time we actually take one, we create the folder: + if (!FileSys.directoryExists(absPath("${THIS_SCREENSHOT_PATH}"))) { + FileSys.createDirectory( + absPath("${THIS_SCREENSHOT_PATH}"), + ghoul::filesystem::FileSystem::Recursive::Yes + ); + } + OsEng.windowWrapper().takeScreenshot(_applyWarping); _shouldTakeScreenshot = false; } diff --git a/src/rendering/renderengine_lua.inl b/src/rendering/renderengine_lua.inl index 538de4bbe1..bda30ee27a 100644 --- a/src/rendering/renderengine_lua.inl +++ b/src/rendering/renderengine_lua.inl @@ -130,7 +130,9 @@ int removeScreenSpaceRenderable(lua_State* L) { if (!s) { LERRORC( "removeScreenSpaceRenderable", - errorLocation(L) << "Could not find ScreenSpaceRenderable '" << name << "'" + fmt::format( + "{}: Could not find ScreenSpaceRenderable '{}'", errorLocation(L), name + ) ); ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); return 0; diff --git a/src/scene/asset.cpp b/src/scene/asset.cpp index 23c1aa0db9..3ad32a7d02 100644 --- a/src/scene/asset.cpp +++ b/src/scene/asset.cpp @@ -23,12 +23,12 @@ ****************************************************************************************/ #include + #include - +#include #include - -#include #include +#include #include namespace { @@ -368,7 +368,7 @@ bool Asset::isInitialized() const { bool Asset::startSynchronizations() { if (!isLoaded()) { - LWARNING("Cannot start synchronizations of unloaded asset " << id()); + LWARNING(fmt::format("Cannot start synchronizations of unloaded asset {}", id())); return false; } for (auto& child : requestedAssets()) { @@ -502,10 +502,10 @@ bool Asset::initialize() { return true; } if (!isSynchronized()) { - LERROR("Cannot initialize unsynchronized asset " << id()); + LERROR(fmt::format("Cannot initialize unsynchronized asset {}", id())); return false; } - LDEBUG("Initializing asset " << id()); + LDEBUG(fmt::format("Initializing asset {}", id())); // 1. Initialize requirements for (auto& child : _requiredAssets) { @@ -523,8 +523,9 @@ bool Asset::initialize() { try { loader()->callOnInitialize(this); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Failed to initialize asset " << id() << ". " << - e.component << ": " << e.message); + LERROR(fmt::format( + "Failed to initialize asset {}; {}: {}", id(), e.component, e.message + )); // TODO: rollback; setState(Asset::State::InitializationFailed); return false; @@ -538,9 +539,13 @@ bool Asset::initialize() { try { loader()->callOnDependencyInitialize(child.get(), this); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Failed to initialize required asset " << - child->id() << " of " << id() << ". " << - e.component << ": " << e.message); + LERROR(fmt::format( + "Failed to initialize required asset {} of {}; {}: {}", + child->id(), + id(), + e.component, + e.message + )); // TODO: rollback; setState(Asset::State::InitializationFailed); return false; @@ -553,9 +558,13 @@ bool Asset::initialize() { try { loader()->callOnDependencyInitialize(child.get(), this); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Failed to initialize requested asset " << - child->id() << " of " << id() << ". " << - e.component << ": " << e.message); + LERROR(fmt::format( + "Failed to initialize requested asset {} of {}; {}: {}", + child->id(), + id(), + e.component, + e.message + )); // TODO: rollback; } } @@ -568,9 +577,13 @@ bool Asset::initialize() { try { loader()->callOnDependencyInitialize(this, p.get()); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Failed to initialize required asset " << - id() << " of " << p->id() << ". " << - e.component << ": " << e.message); + LERROR(fmt::format( + "Failed to initialize required asset {} of {}; {}: {}", + id(), + p->id(), + e.component, + e.message + )); // TODO: rollback; } } @@ -589,7 +602,7 @@ void Asset::deinitialize() { if (!isInitialized()) { return; } - LDEBUG("Deintializing asset " << id()); + LDEBUG(fmt::format("Deintializing asset {}", id())); // Perform inverse actions as in initialize, in reverse order (7 - 1) @@ -601,9 +614,13 @@ void Asset::deinitialize() { loader()->callOnDependencyDeinitialize(this, p.get()); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Failed to deinitialize requested asset " << - id() << " of " << p->id() << ". " << - e.component << ": " << e.message); + LERROR(fmt::format( + "Failed to deinitialize requested asset {} of {}; {}: {}", + id(), + p->id(), + e.component, + e.message + )); } } } @@ -615,9 +632,13 @@ void Asset::deinitialize() { loader()->callOnDependencyDeinitialize(child.get(), this); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Failed to deinitialize requested asset " << - child->id() << " of " << id() << ". " << - e.component << ": " << e.message); + LERROR(fmt::format( + "Failed to deinitialize requested asset {} of {}; {}: {}", + child->id(), + id(), + e.component, + e.message + )); } } } @@ -628,9 +649,13 @@ void Asset::deinitialize() { loader()->callOnDependencyDeinitialize(child.get(), this); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Failed to deinitialize required asset " << - child->id() << " of " << id() << ". " << - e.component << ": " << e.message); + LERROR(fmt::format( + "Failed to deinitialize required asset {} of {}; {}: {}", + child->id(), + id(), + e.component, + e.message + )); } } @@ -642,8 +667,9 @@ void Asset::deinitialize() { loader()->callOnDeinitialize(this); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Failed to deinitialize asset " << id() << ". " << - e.component << ": " << e.message); + LERROR(fmt::format( + "Failed to deinitialize asset {}; {}: {}", id(), e.component, e.message + )); return; } diff --git a/src/scene/assetloader.cpp b/src/scene/assetloader.cpp index 1b2351bb1a..ee8a64542b 100644 --- a/src/scene/assetloader.cpp +++ b/src/scene/assetloader.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include "assetloader_lua.inl" @@ -254,8 +254,9 @@ bool AssetLoader::loadAsset(std::shared_ptr asset) { }; if (!FileSys.fileExists(asset->assetFilePath())) { - LERROR("Could not load asset '" << asset->assetFilePath() << - "': File does not exist."); + LERROR(fmt::format( + "Could not load asset '{}': File does not exist", asset->assetFilePath()) + ); lua_settop(*_luaState, top); return false; } @@ -263,7 +264,9 @@ bool AssetLoader::loadAsset(std::shared_ptr asset) { try { ghoul::lua::runScriptFile(*_luaState, asset->assetFilePath()); } catch (const ghoul::lua::LuaRuntimeException& e) { - LERROR("Could not load asset '" << asset->assetFilePath() << "': " << e.message); + LERROR(fmt::format( + "Could not load asset '{}': {}", asset->assetFilePath(), e.message) + ); lua_settop(*_luaState, top); return false; } diff --git a/src/scene/scene.cpp b/src/scene/scene.cpp index c98aa31631..07c3ca5890 100644 --- a/src/scene/scene.cpp +++ b/src/scene/scene.cpp @@ -197,10 +197,10 @@ void Scene::sortTopologically() { } } if (inDegrees.size() > 0) { - LERROR( - "The scene contains circular dependencies. " << - inDegrees.size() << " nodes will be disabled." - ); + LERROR(fmt::format( + "The scene contains circular dependencies. {} nodes will be disabled", + inDegrees.size() + )); } for (auto it : inDegrees) { @@ -370,8 +370,10 @@ SceneGraphNode* Scene::loadNode(const ghoul::Dictionary& dict) { const bool hasParent = dict.hasKey(KeyParentName); if (_nodesByName.find(nodeName) != _nodesByName.end()) { - LERROR("Cannot add scene graph node " << nodeName << - ". A node with that name already exisis."); + LERROR(fmt::format( + "Cannot add scene graph node '{}'. A node with that name already exists", + nodeName + )); return nullptr; } diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index 2f0e22050d..d0807b0f1f 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -93,11 +93,16 @@ void applyRegularExpression(lua_State* L, std::regex regex, } if (type != prop->typeLua()) { - LERRORC("property_setValue", - errorLocation(L) << "Property '" << - prop->fullyQualifiedIdentifier() << - "' does not accept input of type '" << luaTypeToString(type) << - "'. Requested type: '" << luaTypeToString(prop->typeLua()) << "'" + LERRORC( + "property_setValue", + fmt::format( + "{}: Property '{}' does not accept input of type '{}'. " + "Requested type: '{}'", + errorLocation(L), + prop->fullyQualifiedIdentifier(), + luaTypeToString(type), + luaTypeToString(prop->typeLua()) + ) ); } else { executePropertySet(prop, L); @@ -140,9 +145,17 @@ int setPropertyCall_single(properties::Property* prop, std::string uri, lua_Stat using ghoul::lua::luaTypeToString; if (type != prop->typeLua()) { - LERRORC("property_setValue", errorLocation(L) << "Property '" << uri << - "' does not accept input of type '" << luaTypeToString(type) << - "'. Requested type: '" << luaTypeToString(prop->typeLua()) << "'"); + LERRORC( + "property_setValue", + fmt::format( + "{}: Property '{}' does not accept input of type '{}'. " + "Requested type: '{}'", + errorLocation(L), + uri, + luaTypeToString(type), + luaTypeToString(prop->typeLua()) + ) + ); } else { prop->setLuaValue(L); @@ -199,8 +212,14 @@ int property_setValueSingle(lua_State* L) { } else { properties::Property* prop = property(uri); if (!prop) { - LERRORC("property_setValue", errorLocation(L) << "Property with URI '" - << uri << "' was not found"); + LERRORC( + "property_setValue", + fmt::format( + "{}: Property with URI '{}' was not found", + errorLocation(L), + uri + ) + ); return 0; } setPropertyCall_single(prop, uri, L, type); @@ -291,8 +310,12 @@ int property_setValueRegex(lua_State* L) { ); } catch (const std::regex_error& e) { - LERRORC("property_setValueRegex", "Malformed regular expression: '" - << regex << "':" << e.what()); + LERRORC( + "property_setValueRegex", + fmt::format( + "Malformed regular expression: '{}': {}", regex, e.what() + ) + ); } return 0; @@ -317,7 +340,11 @@ int property_getValue(lua_State* L) { if (!prop) { LERRORC( "property_getValue", - errorLocation(L) << "Property with URL '" << uri << "' was not found" + fmt::format( + "{}: Property with URI '{}' was not found", + errorLocation(L), + uri + ) ); ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); return 0; @@ -394,16 +421,16 @@ int removeSceneGraphNode(lua_State* L) { if (!node) { LERRORC( "removeSceneGraphNode", - errorLocation(L) << "Could not find node '" << nodeName << "'" - ); + fmt::format("{}: Could not find node '{}'", errorLocation(L), nodeName) + ); return 0; } SceneGraphNode* parent = node->parent(); if (!parent) { LERRORC( "removeSceneGraphNode", - errorLocation(L) << "Cannot remove root node" - ); + fmt::format("{}: Cannot remove root node", errorLocation(L)) + ); return 0; } node->deinitializeGL(); diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index 678dac0f4e..46bf237288 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -93,12 +93,15 @@ std::unique_ptr SceneGraphNode::createFromDictionary( translationDictionary ); if (result->_transform.translation == nullptr) { - LERROR("Failed to create ephemeris for SceneGraphNode '" - << result->name() << "'"); + LERROR(fmt::format( + "Failed to create ephemeris for SceneGraphNode '{}'", result->name() + )); return nullptr; } result->addPropertySubOwner(result->_transform.translation.get()); - LDEBUG("Successfully created ephemeris for '" << result->name() << "'"); + LDEBUG(fmt::format( + "Successfully created ephemeris for '{}'", result->name() + )); } if (dictionary.hasKey(keyTransformRotation)) { @@ -106,12 +109,13 @@ std::unique_ptr SceneGraphNode::createFromDictionary( dictionary.getValue(keyTransformRotation, rotationDictionary); result->_transform.rotation = Rotation::createFromDictionary(rotationDictionary); if (result->_transform.rotation == nullptr) { - LERROR("Failed to create rotation for SceneGraphNode '" - << result->name() << "'"); + LERROR(fmt::format( + "Failed to create rotation for SceneGraphNode '{}'", result->name() + )); return nullptr; } result->addPropertySubOwner(result->_transform.rotation.get()); - LDEBUG("Successfully created rotation for '" << result->name() << "'"); + LDEBUG(fmt::format("Successfully created rotation for '{}'", result->name())); } if (dictionary.hasKey(keyTransformScale)) { @@ -119,12 +123,13 @@ std::unique_ptr SceneGraphNode::createFromDictionary( dictionary.getValue(keyTransformScale, scaleDictionary); result->_transform.scale = Scale::createFromDictionary(scaleDictionary); if (result->_transform.scale == nullptr) { - LERROR("Failed to create scale for SceneGraphNode '" - << result->name() << "'"); + LERROR(fmt::format( + "Failed to create scale for SceneGraphNode '{}'", result->name() + )); return nullptr; } result->addPropertySubOwner(result->_transform.scale.get()); - LDEBUG("Successfully created scale for '" << result->name() << "'"); + LDEBUG(fmt::format("Successfully created scale for '{}'", result->name())); } // We initialize the renderable last as it probably has the most dependencies @@ -136,12 +141,13 @@ std::unique_ptr SceneGraphNode::createFromDictionary( result->_renderable = Renderable::createFromDictionary(renderableDictionary); if (result->_renderable == nullptr) { - LERROR("Failed to create renderable for SceneGraphNode '" - << result->name() << "'"); + LERROR(fmt::format( + "Failed to create renderable for SceneGraphNode '{}'", result->name() + )); return nullptr; } result->addPropertySubOwner(result->_renderable.get()); - LDEBUG("Successfully created renderable for '" << result->name() << "'"); + LDEBUG(fmt::format("Successfully created renderable for '{}'", result->name())); } if (dictionary.hasKey(KeyTag)) { @@ -167,8 +173,7 @@ std::unique_ptr SceneGraphNode::createFromDictionary( result->_guiPath = dictionary.value(KeyGuiPath); } - LDEBUG("Successfully created SceneGraphNode '" - << result->name() << "'"); + LDEBUG(fmt::format("Successfully created SceneGraphNode '{}'", result->name())); return result; } @@ -189,7 +194,7 @@ SceneGraphNode::SceneGraphNode() SceneGraphNode::~SceneGraphNode() {} void SceneGraphNode::initialize() { - LDEBUG("Initialize: " << name()); + LDEBUG(fmt::format("Initialize: {}", name())); if (_renderable) { _renderable->initialize(); } @@ -214,7 +219,7 @@ void SceneGraphNode::initializeGL() { } void SceneGraphNode::deinitialize() { - LDEBUG("Deinitialize: " << name()); + LDEBUG(fmt::format("Deinitialize: {}", name())); setScene(nullptr); diff --git a/src/scripting/scriptengine.cpp b/src/scripting/scriptengine.cpp index 3cc2478391..5d70cfa16d 100644 --- a/src/scripting/scriptengine.cpp +++ b/src/scripting/scriptengine.cpp @@ -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; } diff --git a/src/scripting/scriptengine_lua.inl b/src/scripting/scriptengine_lua.inl index 91a61df7ae..89462a04b0 100644 --- a/src/scripting/scriptengine_lua.inl +++ b/src/scripting/scriptengine_lua.inl @@ -23,6 +23,7 @@ ****************************************************************************************/ #include +#include namespace openspace::luascriptfunctions { @@ -96,19 +97,22 @@ int printInternal(ghoul::logging::LogLevel level, lua_State* L) { case LUA_TFUNCTION: case LUA_TUSERDATA: case LUA_TTHREAD: - LOGC(level, "print", "Function parameter was of type '" << - luaTypeToString(type) << "'"); + log( + level, + "print", + fmt::format("Function parameter was of type '{}'", luaTypeToString(type)) + ); break; case LUA_TNIL: break; case LUA_TBOOLEAN: - LOGC(level, "print", lua_toboolean(L, -1)); + log(level, "print", fmt::format("{}", lua_toboolean(L, -1))); break; case LUA_TNUMBER: - LOGC(level, "print", lua_tonumber(L, -1)); + log(level, "print", fmt::format("{}", lua_tonumber(L, -1))); break; case LUA_TSTRING: - LOGC(level, "print", lua_tostring(L, -1)); + log(level, "print", lua_tostring(L, -1)); break; } lua_settop(L, 0); diff --git a/src/scripting/scriptscheduler.cpp b/src/scripting/scriptscheduler.cpp index cc4d03f706..0fe0b24e7a 100644 --- a/src/scripting/scriptscheduler.cpp +++ b/src/scripting/scriptscheduler.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +//#include #include #include diff --git a/src/scripting/systemcapabilitiesbinding.cpp b/src/scripting/systemcapabilitiesbinding.cpp index 5c237bafd1..0b892477a6 100644 --- a/src/scripting/systemcapabilitiesbinding.cpp +++ b/src/scripting/systemcapabilitiesbinding.cpp @@ -25,12 +25,11 @@ #include #include - +#include #include #include #include #include - #include using namespace ghoul::lua; @@ -87,7 +86,10 @@ int hasOpenGLVersion(lua_State* L) { std::vector v = ghoul::tokenizeString(ghoul::lua::checkStringAndPop(L)); if (v.size() != 2 && v.size() != 3) { - LERRORC("hasVersion", ghoul::lua::errorLocation(L) << "Malformed version string"); + LERRORC( + "hasVersion", + fmt::format("{}: Malformed version string", ghoul::lua::errorLocation(L)) + ); return 0; } @@ -96,7 +98,9 @@ int hasOpenGLVersion(lua_State* L) { if (!std::isdigit(c)) { LERRORC( "hasVersion", - ghoul::lua::errorLocation(L) << "Malformed version string" + fmt::format( + "{}: Malformed version string", ghoul::lua::errorLocation(L) + ) ); return 0; } diff --git a/src/util/httprequest.cpp b/src/util/httprequest.cpp index b88a861a90..d4ec3a9920 100644 --- a/src/util/httprequest.cpp +++ b/src/util/httprequest.cpp @@ -24,6 +24,7 @@ #include +#include #include #include #include @@ -320,7 +321,7 @@ HttpFileDownload::HttpFileDownload( bool HttpFileDownload::initDownload() { if (!_overwrite && FileSys.fileExists(_destination)) { - LWARNING("File " << _destination << " already exists!"); + LWARNING(fmt::format("File {} already exists", _destination)); return false; } @@ -361,33 +362,35 @@ bool HttpFileDownload::initDownload() { std::string message(Buffer, size); - LERROR("Cannot open file " << destinationFile << ": " << message); + LERROR(fmt::format("Cannot open file {}: {}", destinationFile, message)); return false; } else { - LERROR("Cannot open file " << destinationFile); + LERROR(fmt::format("Cannot open file {}", destinationFile)); return false; } #else if (errno) { #if defined(__unix__) char buffer[255]; - LERROR( - "Cannot open file " << destinationFile << ": " << + LERROR(fmt::format( + "Cannot open file '{}': {}", + destinationFile, std::string(strerror_r(errno, buffer, sizeof(buffer))) - ); + )); return false; #else - LERROR( - "Cannot open file " << destinationFile << ": " << + LERROR(fmt::format( + "Cannot open file '{}': {}", + destinationFile, std::string(strerror(errno)) - ); + )); return false; #endif } - LERROR("Cannot open file " << destinationFile); + LERROR(fmt::format("Cannot open file {}", destinationFile)); return false; #endif } diff --git a/src/util/keys.cpp b/src/util/keys.cpp index 87f3969cd0..a7d17f76ee 100644 --- a/src/util/keys.cpp +++ b/src/util/keys.cpp @@ -24,6 +24,7 @@ #include +#include #include #include @@ -102,7 +103,7 @@ KeyWithModifier stringToKey(std::string str) { m |= itMod->second; } else { - LERROR("Unknown modifier key '" << s << "'"); + LERROR(fmt::format("Unknown modifier key '{}'", s)); } } ); diff --git a/src/util/openspacemodule.cpp b/src/util/openspacemodule.cpp index 12ea8def9d..197dfb40ae 100644 --- a/src/util/openspacemodule.cpp +++ b/src/util/openspacemodule.cpp @@ -26,7 +26,8 @@ #include -#include +#include +#include #include #include @@ -63,7 +64,7 @@ void OpenSpaceModule::initialize(const ModuleEngine* moduleEngine, ghoul::filesystem::FileSystem::TokenClosingBraces; std::string path = modulePath(); - LDEBUG("Registering module path: " << moduleToken << ": " << path); + LDEBUG(fmt::format("Registering module path {}: {}", moduleToken, path)); FileSys.registerPathToken(moduleToken, path); _moduleEngine = moduleEngine; diff --git a/src/util/screenlog.cpp b/src/util/screenlog.cpp index 5fc063c4bc..e0ce4c8e2e 100644 --- a/src/util/screenlog.cpp +++ b/src/util/screenlog.cpp @@ -57,7 +57,7 @@ void ScreenLog::log(LogLevel level, const string& category, const string& messag _entries.push_back({ level, std::chrono::steady_clock::now(), - Log::getTimeString(), + Log::timeString(), category, message }); diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index b75da976b8..6cf77c1580 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -32,7 +33,7 @@ #include #include -#include +#include #include "SpiceUsr.h" #include "SpiceZpr.h" @@ -43,7 +44,7 @@ namespace { // The value comes from // http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/getmsg_c.html // as the maximum message length - const unsigned SpiceErrorBufferSize = 1841; + constexpr const unsigned SpiceErrorBufferSize = 1841; // This method checks if one of the previous SPICE methods has failed. If it has, an // exception with the SPICE error message is thrown @@ -239,7 +240,7 @@ SpiceManager::KernelHandle SpiceManager::loadKernel(string filePath) { string fileDirectory = ghoul::filesystem::File(path, RawPath::Yes).directoryName(); FileSys.setCurrentDirectory(fileDirectory); - LINFO("Loading SPICE kernel '" << path << "'"); + LINFO(fmt::format("Loading SPICE kernel '{}'", path)); // Load the kernel furnsh_c(path.c_str()); diff --git a/src/util/spicemanager_lua.inl b/src/util/spicemanager_lua.inl index 330c167475..fa26c3572e 100644 --- a/src/util/spicemanager_lua.inl +++ b/src/util/spicemanager_lua.inl @@ -22,6 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include + namespace openspace::luascriptfunctions { /** @@ -36,7 +38,9 @@ int loadKernel(lua_State* L) { bool isString = (lua_isstring(L, -1) == 1); if (!isString) { - LERROR(ghoul::lua::errorLocation(L) << "Expected argument of type 'string'"); + LERROR(fmt::format( + "{}: Expected argument of type 'string'", ghoul::lua::errorLocation(L) + )); return 0; } @@ -66,8 +70,10 @@ int unloadKernel(lua_State* L) { if (!isString && !isNumber) { LERRORC( "loadKernel", - ghoul::lua::errorLocation(L) << - "Expected argument of type 'string' or 'number'" + fmt::format( + "{}: Expected argument of type 'string' or 'number'", + ghoul::lua::errorLocation(L) + ) ); lua_settop(L, 0); ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack"); diff --git a/src/util/taskloader.cpp b/src/util/taskloader.cpp index 1278b6b9f5..f5cb1a21bb 100644 --- a/src/util/taskloader.cpp +++ b/src/util/taskloader.cpp @@ -24,6 +24,7 @@ #include +#include #include #include #include @@ -54,7 +55,9 @@ std::vector> TaskLoader::tasksFromDictionary( std::string taskType = subTask.value("Type"); std::unique_ptr task = Task::createFromDictionary(subTask); if (!task) { - LERROR("Failed to create a Task object of type '" << taskType << "'"); + LERROR(fmt::format( + "Failed to create a Task object of type '{}'", taskType + )); } tasks.push_back(std::move(task)); } @@ -65,8 +68,9 @@ std::vector> TaskLoader::tasksFromDictionary( std::vector> TaskLoader::tasksFromFile(const std::string& path) { std::string absTasksFile = absPath(path); if (!FileSys.fileExists(ghoul::filesystem::File(absTasksFile))) { - LERROR("Could not load tasks file '" << absTasksFile << "'. " << - "File not found"); + LERROR(fmt::format( + "Could not load tasks file '{}. File not found", absTasksFile + )); return std::vector>(); } @@ -77,8 +81,12 @@ std::vector> TaskLoader::tasksFromFile(const std::string& tasksDictionary ); } catch (const ghoul::RuntimeError& e) { - LERROR("Could not load tasks file '" << absTasksFile << "'. " << - "Lua error: " << e.message << ": " << e.component); + LERROR(fmt::format( + "Could not load tasks file '{}. Lua error: {}: {}", + absTasksFile, + e.message, + e.component + )); return std::vector>(); } return tasksFromDictionary(tasksDictionary); diff --git a/src/util/time_lua.inl b/src/util/time_lua.inl index 396a86f552..996d8bb56c 100644 --- a/src/util/time_lua.inl +++ b/src/util/time_lua.inl @@ -24,7 +24,7 @@ #include -#include +#include #include namespace openspace::luascriptfunctions { diff --git a/tests/main.cpp b/tests/main.cpp index 7d828d58ed..1016a8cfe3 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -54,9 +54,9 @@ #include #include #include -#include -#include -#include +//#include +//#include +//#include #include #include #include diff --git a/tests/test_gdalwms.inl b/tests/test_gdalwms.inl index 23de410577..c1aeaacab3 100644 --- a/tests/test_gdalwms.inl +++ b/tests/test_gdalwms.inl @@ -33,8 +33,6 @@ #include "cpl_conv.h" #include "cpl_string.h" -#include - // Error: cannot open source file "wms/wmsdriver.h" //#include "wms/wmsdriver.h"