diff --git a/isis/src/base/apps/automos/automos.cpp b/isis/src/base/apps/automos/automos.cpp index 93d6ed03ec..90896db327 100644 --- a/isis/src/base/apps/automos/automos.cpp +++ b/isis/src/base/apps/automos/automos.cpp @@ -1,10 +1,12 @@ #include "automos.h" -#include "ProcessMapMosaic.h" + +#include "Application.h" #include "FileList.h" #include "IException.h" +#include "ProcessMapMosaic.h" +#include "ProjectionFactory.h" #include "SpecialPixel.h" #include "TProjection.h" -#include "ProjectionFactory.h" using namespace std; @@ -77,9 +79,7 @@ namespace Isis { if (!m.StartProcess(list[i].toString())) { PvlGroup outsiders("Outside"); outsiders += PvlKeyword("File", list[i].toString()); - if (log) { - log->addLogGroup(outsiders); - } + Application::AppendAndLog(outsiders, log); } else { mosaicCreated = true; @@ -94,9 +94,7 @@ namespace Isis { } // Logs the input file location in the mosaic for (int i = 0; i < m.imagePositions().groups(); i++) { - if (log) { - log->addLogGroup(m.imagePositions().group(i)); - } + Application::AppendAndLog(m.imagePositions().group(i), log); } if(olistFlag) { diff --git a/isis/src/base/apps/cam2map/cam2map.cpp b/isis/src/base/apps/cam2map/cam2map.cpp index 9f30e32896..10b93a8d61 100644 --- a/isis/src/base/apps/cam2map/cam2map.cpp +++ b/isis/src/base/apps/cam2map/cam2map.cpp @@ -1,5 +1,6 @@ #include "cam2map.h" +#include "Application.h" #include "Camera.h" #include "CubeAttribute.h" #include "IException.h" @@ -432,9 +433,7 @@ namespace Isis { p.EndProcess(); // add mapping to print.prt - if(log) { - log->addLogGroup(cleanMapping); - } + Application::Log(cleanMapping); // Cleanup delete outmap; diff --git a/isis/src/base/apps/campt/campt.cpp b/isis/src/base/apps/campt/campt.cpp index d4f2b52217..74ddd8395f 100644 --- a/isis/src/base/apps/campt/campt.cpp +++ b/isis/src/base/apps/campt/campt.cpp @@ -3,6 +3,7 @@ #include #include +#include "Application.h" #include "Brick.h" #include "Camera.h" #include "CameraPointInfo.h" @@ -272,7 +273,7 @@ namespace Isis{ } // we still want to output the results - log->addLogGroup((*point)); + Application::AppendAndLog((*point), log); delete point; point = NULL; } diff --git a/isis/src/base/apps/camrange/camrange.cpp b/isis/src/base/apps/camrange/camrange.cpp index 1e9e3f5976..e4a6c2f375 100644 --- a/isis/src/base/apps/camrange/camrange.cpp +++ b/isis/src/base/apps/camrange/camrange.cpp @@ -1,9 +1,10 @@ -#include "UserInterface.h" +#include "Application.h" #include "Camera.h" #include "Target.h" #include "Distance.h" #include "Process.h" #include "Pvl.h" +#include "UserInterface.h" #include "camrange.h" @@ -98,13 +99,13 @@ namespace Isis { neg180 += PvlKeyword("MinimumLongitude", toString(minlon)); neg180 += PvlKeyword("MaximumLongitude", toString(maxlon)); - log->addLogGroup(target); - log->addLogGroup(res); - log->addLogGroup(ugr); - log->addLogGroup(ogr); - log->addLogGroup(pos360); - log->addLogGroup(pos180); - log->addLogGroup(neg180); + Application::AppendAndLog(target, log); + Application::AppendAndLog(res, log); + Application::AppendAndLog(ugr, log); + Application::AppendAndLog(ogr, log); + Application::AppendAndLog(pos360, log); + Application::AppendAndLog(pos180, log); + Application::AppendAndLog(neg180, log); // Write the log->file if requested if(ui.WasEntered("TO")) { diff --git a/isis/src/base/apps/camstats/camstats.cpp b/isis/src/base/apps/camstats/camstats.cpp index c9638ce33f..c094816330 100644 --- a/isis/src/base/apps/camstats/camstats.cpp +++ b/isis/src/base/apps/camstats/camstats.cpp @@ -1,5 +1,7 @@ #include "camstats.h" + +#include "Application.h" #include "Camera.h" #include "CameraStatistics.h" #include "Cube.h" @@ -51,7 +53,7 @@ namespace Isis { // Send the Output to the log area Pvl statsPvl = camStats.toPvl(); for (int i = 0; i < statsPvl.groups(); i++) { - log->addLogGroup(statsPvl.group(i)); + Application::AppendAndLog(statsPvl.group(i), log); } if(ui.WasEntered("TO")) { diff --git a/isis/src/base/apps/ckwriter/ckwriter.cpp b/isis/src/base/apps/ckwriter/ckwriter.cpp index bf64831c4e..47e0949d21 100644 --- a/isis/src/base/apps/ckwriter/ckwriter.cpp +++ b/isis/src/base/apps/ckwriter/ckwriter.cpp @@ -2,6 +2,7 @@ #include "ckwriter.h" +#include "Application.h" #include "Cube.h" #include "FileList.h" #include "Process.h" @@ -50,9 +51,7 @@ namespace Isis { PvlGroup overlap = overrors.group(i); overlap.setName("Overlaps"); overlap.addKeyword(PvlKeyword("Class", "WARNING"), PvlContainer::Replace); - if (log) { - log->addLogGroup(overlap); - } + Application::AppendAndLog(overlap, log); } } diff --git a/isis/src/base/apps/cubeit/cubeit.cpp b/isis/src/base/apps/cubeit/cubeit.cpp index 4790452b5f..91e4eb9027 100644 --- a/isis/src/base/apps/cubeit/cubeit.cpp +++ b/isis/src/base/apps/cubeit/cubeit.cpp @@ -1,5 +1,6 @@ #include "cubeit.h" +#include "Application.h" #include "ProcessByLine.h" #include "ProcessMosaic.h" #include "IException.h" @@ -115,9 +116,7 @@ namespace Isis { } //Only write out results group if we added something to it. if (results.hasKeyword("UnpropagatedBand")) { - if (log){ - log->addLogGroup(results); - } + Application::Log(results); } } catch(IException &e) { diff --git a/isis/src/base/apps/demprep/demprep.cpp b/isis/src/base/apps/demprep/demprep.cpp index a1cc57648f..f3c73e6298 100644 --- a/isis/src/base/apps/demprep/demprep.cpp +++ b/isis/src/base/apps/demprep/demprep.cpp @@ -1,5 +1,6 @@ #include +#include "Application.h" #include "Distance.h" #include "ProcessByLine.h" #include "TProjection.h" @@ -67,9 +68,7 @@ namespace Isis{ PvlGroup demRange("Results"); demRange += PvlKeyword("MinimumRadius", toString(inCubeStats.Minimum()), "meters"); demRange += PvlKeyword("MaximumRadius", toString(inCubeStats.Maximum()), "meters"); - if (log){ - log->addLogGroup(demRange); - } + Application::Log(demRange); // Store min/max radii values in new ShapeModelStatistics table QString shp_name = "ShapeModelStatistics"; @@ -267,9 +266,7 @@ namespace Isis{ PvlGroup demRange("Results"); demRange += PvlKeyword("MinimumRadius", toString(outCubeStats.Minimum()), "meters"); demRange += PvlKeyword("MaximumRadius", toString(outCubeStats.Maximum()), "meters"); - if (log){ - log->addLogGroup(demRange); - } + Application::Log(demRange); // Store min/max radii values in new ShapeModelStatistics table QString shp_name = "ShapeModelStatistics"; diff --git a/isis/src/base/apps/enlarge/enlarge_app.cpp b/isis/src/base/apps/enlarge/enlarge_app.cpp index f06414ece9..81b8e11c3d 100644 --- a/isis/src/base/apps/enlarge/enlarge_app.cpp +++ b/isis/src/base/apps/enlarge/enlarge_app.cpp @@ -1,5 +1,6 @@ #include "enlarge_app.h" +#include "Application.h" #include "CubeAttribute.h" #include "Enlarge.h" #include "IException.h" @@ -94,7 +95,7 @@ namespace Isis{ delete interp; // Write the results to the log - log->addLogGroup(resultsGrp); + Application::AppendAndLog(resultsGrp, log); } } diff --git a/isis/src/base/apps/fillgap/fillgap.cpp b/isis/src/base/apps/fillgap/fillgap.cpp index baf474fb7c..5757c6be76 100644 --- a/isis/src/base/apps/fillgap/fillgap.cpp +++ b/isis/src/base/apps/fillgap/fillgap.cpp @@ -1,4 +1,6 @@ #include + +#include "Application.h" #include "ProcessBySample.h" #include "ProcessByLine.h" #include "ProcessBySpectra.h" @@ -77,7 +79,7 @@ namespace Isis { PvlGroup mLog("Messages"); mLog += PvlKeyword("Warning", "Unable to fill " + toString(numSpecPixKept) + " special pixels."); - log->addLogGroup(mLog); + Application::AppendAndLog(mLog, log); } return; } diff --git a/isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp b/isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp index 3e496e1328..65b9a9721a 100644 --- a/isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp +++ b/isis/src/base/apps/findimageoverlaps/findimageoverlaps.cpp @@ -86,8 +86,6 @@ namespace Isis { PvlGroup results("Results"); results += PvlKeyword("ErrorCount", toString((BigInt)overlaps.Errors().size())); - if (log) { - log->addLogGroup(results); - } + Application::Log(results); } } diff --git a/isis/src/base/apps/footprintinit/footprintinit.cpp b/isis/src/base/apps/footprintinit/footprintinit.cpp index 7ab7bd8f41..a7dd4ad3de 100644 --- a/isis/src/base/apps/footprintinit/footprintinit.cpp +++ b/isis/src/base/apps/footprintinit/footprintinit.cpp @@ -144,7 +144,7 @@ namespace Isis { PvlGroup results("Results"); results.addKeyword(PvlKeyword("SINC", toString(sinc))); results.addKeyword(PvlKeyword("LINC", toString(linc))); - log->addLogGroup(results); + Application::AppendAndLog(results, log); } Process p; diff --git a/isis/src/base/apps/getsn/getsn.cpp b/isis/src/base/apps/getsn/getsn.cpp index 0d17dc7119..4dbdd72df8 100644 --- a/isis/src/base/apps/getsn/getsn.cpp +++ b/isis/src/base/apps/getsn/getsn.cpp @@ -4,6 +4,7 @@ #include #include +#include "Application.h" #include "Blob.h" #include "Cube.h" #include "History.h" @@ -88,9 +89,8 @@ namespace Isis { cout << sn[i][0] << endl; } } - if (ui.IsInteractive()) { - log->addLogGroup(sn); + Application::AppendAndLog(sn, log); } else { log->addGroup(sn); diff --git a/isis/src/base/apps/isis2pds/isis2pds.cpp b/isis/src/base/apps/isis2pds/isis2pds.cpp index e2b89ac169..9250d82bd9 100644 --- a/isis/src/base/apps/isis2pds/isis2pds.cpp +++ b/isis/src/base/apps/isis2pds/isis2pds.cpp @@ -1,5 +1,6 @@ #include +#include "Application.h" #include "Cube.h" #include "ExportDescription.h" #include "FileName.h" @@ -119,9 +120,7 @@ namespace Isis{ results += PvlKeyword("HRS", toString(p.OutputHrs())); results += PvlKeyword("ValidMin", toString(min)); results += PvlKeyword("ValidMax", toString(max)); - if (log){ - log->addLogGroup(results); - } + Application::Log(results); } else { // Setup the process and set the input cube @@ -195,9 +194,7 @@ namespace Isis{ results += PvlKeyword("HRS", toString(process.OutputHrs())); results += PvlKeyword("ValidMin", toString(min)); results += PvlKeyword("ValidMax", toString(max)); - if (log){ - log->addLogGroup(results); - } + Application::Log(results); process.StandardPds4Label(); process.WritePds4(outFileName); diff --git a/isis/src/base/apps/isisexport/isisexport.cpp b/isis/src/base/apps/isisexport/isisexport.cpp index 9123ff9ae0..4583a68016 100644 --- a/isis/src/base/apps/isisexport/isisexport.cpp +++ b/isis/src/base/apps/isisexport/isisexport.cpp @@ -9,6 +9,7 @@ #include #include "cubeatt.h" +#include "Application.h" #include "CubeAttribute.h" #include "FileName.h" #include "md5wrapper.h" @@ -54,7 +55,7 @@ namespace Isis { cubeatt(icube, outputCubePath, outputAttributes); json dataSource; - Environment env; + inja::Environment env; Pvl &cubeLabel = *icube->label(); @@ -127,7 +128,7 @@ namespace Isis { + "Previous value [" + QString::fromStdString(dataSource["ExtraPvl"][element.key()].dump()) + "] will be overwritten."; duplicateWarnings += PvlKeyword("Duplicate", message); - log->addLogGroup(duplicateWarnings); + Application::AppendAndLog(duplicateWarnings, log); } } } @@ -150,7 +151,7 @@ namespace Isis { + "Previous value [" + QString::fromStdString(dataSource["ExtraXml"][element.key()].dump()) + "] will be overwritten."; duplicateWarnings += PvlKeyword("Duplicate", message); - log->addLogGroup(duplicateWarnings); + Application::AppendAndLog(duplicateWarnings, log); } } } @@ -174,7 +175,7 @@ namespace Isis { + "Previous value [" + QString::fromStdString(dataSource["ExtraJson"][element.key()].dump()) + "] will be overwritten."; duplicateWarnings += PvlKeyword("Duplicate", message); - log->addLogGroup(duplicateWarnings); + Application::AppendAndLog(duplicateWarnings, log); } } } diff --git a/isis/src/base/apps/isisimport/isisimport.cpp b/isis/src/base/apps/isisimport/isisimport.cpp index 2c6f2bfb60..743a71276d 100644 --- a/isis/src/base/apps/isisimport/isisimport.cpp +++ b/isis/src/base/apps/isisimport/isisimport.cpp @@ -52,7 +52,7 @@ namespace Isis { throw IException(IException::User, msg, _FILEINFO_); } } - Environment env; + inja::Environment env; // Dump the JSON to the debugging file if requested // This needs to be above all uses of the JSON by the template engine diff --git a/isis/src/base/apps/map2map/map2map.cpp b/isis/src/base/apps/map2map/map2map.cpp index bc9e1f547d..c791aa3519 100644 --- a/isis/src/base/apps/map2map/map2map.cpp +++ b/isis/src/base/apps/map2map/map2map.cpp @@ -1,3 +1,4 @@ +#include "Application.h" #include "ProcessRubberSheet.h" #include "ProjectionFactory.h" #include "TProjection.h" @@ -369,9 +370,7 @@ namespace Isis { p.StartProcess(*transform, *interp); p.EndProcess(); - if (log){ - log->addLogGroup(cleanOutGrp); - } + Application::Log(cleanOutGrp); // Cleanup delete transform; diff --git a/isis/src/base/apps/mapmos/mapmos.cpp b/isis/src/base/apps/mapmos/mapmos.cpp index b304f27722..0201b6f2dc 100644 --- a/isis/src/base/apps/mapmos/mapmos.cpp +++ b/isis/src/base/apps/mapmos/mapmos.cpp @@ -2,6 +2,7 @@ #include +#include "Application.h" #include "ProcessMapMosaic.h" #include "PvlGroup.h" @@ -100,12 +101,12 @@ namespace Isis { // Logs the cube if it falls outside of the given mosaic PvlGroup outsiders("Outside"); outsiders += PvlKeyword("File", sInputFile); - log->addLogGroup(outsiders); + Application::AppendAndLog(outsiders, log); } else { // Logs the input file location in the mosaic for (int i = 0; i < m.imagePositions().groups(); i++) { - log->addLogGroup(m.imagePositions().group(i)); + Application::AppendAndLog(m.imagePositions().group(i), log); } } diff --git a/isis/src/base/apps/mappt/mappt.cpp b/isis/src/base/apps/mappt/mappt.cpp index dc5c4b9d46..d0d1438884 100644 --- a/isis/src/base/apps/mappt/mappt.cpp +++ b/isis/src/base/apps/mappt/mappt.cpp @@ -1,6 +1,7 @@ #include #include +#include "Application.h" #include "Brick.h" #include "FileName.h" #include "IException.h" @@ -41,7 +42,7 @@ void mappt(Cube *icube, UserInterface &ui, Pvl *log, CubeAttributeInput* inAtt) if(log) { for(int i = 0; i < points.size(); i++) { PvlGroup g = getProjPointInfo(icube, points[i], ui, log); - log->addLogGroup(g); + Application::AppendAndLog(g, log); } } diff --git a/isis/src/base/apps/maptrim/maptrim.cpp b/isis/src/base/apps/maptrim/maptrim.cpp index 2f69a3a720..89fdc5c12b 100644 --- a/isis/src/base/apps/maptrim/maptrim.cpp +++ b/isis/src/base/apps/maptrim/maptrim.cpp @@ -1,5 +1,6 @@ #include +#include "Application.h" #include "FileName.h" #include "IException.h" #include "IString.h" @@ -115,9 +116,7 @@ namespace Isis{ } // Add mapping to print.prt PvlGroup mapping = proj->Mapping(); - if (log){ - log->addLogGroup(mapping); - } + Application::AppendAndLog(mapping, log); delete proj; proj = NULL; diff --git a/isis/src/base/apps/mosrange/mosrange.cpp b/isis/src/base/apps/mosrange/mosrange.cpp index df876e85b1..a5cee78c52 100644 --- a/isis/src/base/apps/mosrange/mosrange.cpp +++ b/isis/src/base/apps/mosrange/mosrange.cpp @@ -12,6 +12,7 @@ find files of those names at the top level of this repository. **/ #include #include +#include "Application.h" #include "Camera.h" #include "Cube.h" #include "Distance.h" @@ -312,7 +313,7 @@ namespace Isis { mapping += PvlKeyword("PreciseMinimumLongitude", toString(longitudeStat.Minimum())); mapping += PvlKeyword("PreciseMaximumLongitude", toString(longitudeStat.Maximum())); - log.addGroup(mapping); + Application::AppendAndLog(mapping, &log); // Write the output file if requested if(ui.WasEntered("TO")) { diff --git a/isis/src/base/apps/nocam2map/nocam2map.cpp b/isis/src/base/apps/nocam2map/nocam2map.cpp index 322718627d..22923aa938 100644 --- a/isis/src/base/apps/nocam2map/nocam2map.cpp +++ b/isis/src/base/apps/nocam2map/nocam2map.cpp @@ -7,6 +7,7 @@ #include +#include "Application.h" #include "Cube.h" #include "Brick.h" #include "Constants.h" @@ -184,10 +185,8 @@ namespace Isis { error += PvlKeyword("LineAverageError", toString(lineErr.Average())); error += PvlKeyword("LineMaximumError", toString(lineErr.Maximum())); error += PvlKeyword("LineStdDeviationError", toString(lineErr.StandardDeviation())); - - if (log) { - log->addLogGroup(error); - } + + Application::Log(error); //Close the input cubes for cleanup p.EndProcess(); @@ -463,10 +462,8 @@ namespace Isis { // add mapping to print.prt PvlGroup mapping = outmap->Mapping(); - - if (log) { - log->addLogGroup(mapping); - } + + Application::Log(mapping); //Clean up delete latCube; diff --git a/isis/src/base/apps/overlapstats/overlapstats.cpp b/isis/src/base/apps/overlapstats/overlapstats.cpp index 731aa2267c..d7d7ecadea 100644 --- a/isis/src/base/apps/overlapstats/overlapstats.cpp +++ b/isis/src/base/apps/overlapstats/overlapstats.cpp @@ -2,6 +2,7 @@ #include #include "overlapstats.h" +#include "Application.h" #include "SerialNumberList.h" #include "ImageOverlapSet.h" #include "ImageOverlap.h" @@ -244,7 +245,7 @@ namespace Isis { } } - log->addLogGroup(brief); + Application::AppendAndLog(brief, log); //Log the ERRORS file if (ui.WasEntered("ERRORS")) { @@ -260,7 +261,7 @@ namespace Isis { PvlGroup grp("OverlapStats"); PvlKeyword key("ErrorNumber", toString(errorNum)); grp.addKeyword(key); - log->addLogGroup(grp); + Application::AppendAndLog(grp, log); } // Display FULL output @@ -276,7 +277,7 @@ namespace Isis { } } - log->addLogGroup(brief); + Application::AppendAndLog(brief, log); } diff --git a/isis/src/base/apps/pds2isis/pds2isis.cpp b/isis/src/base/apps/pds2isis/pds2isis.cpp index 684971f7c7..7c01988d15 100644 --- a/isis/src/base/apps/pds2isis/pds2isis.cpp +++ b/isis/src/base/apps/pds2isis/pds2isis.cpp @@ -1,5 +1,6 @@ #include "ProcessImportPds.h" +#include "Application.h" #include "UserInterface.h" #include "FileName.h" @@ -73,7 +74,7 @@ namespace Isis { results.setName("Results"); results[0].addComment("Projection offsets and multipliers have been changed from"); results[0].addComment("defaults. New values are below."); - log->addLogGroup(results); + Application::Log(results); } p.EndProcess(); diff --git a/isis/src/base/apps/reduce/reduce_app.cpp b/isis/src/base/apps/reduce/reduce_app.cpp index 144478b96b..929eb7bf0a 100644 --- a/isis/src/base/apps/reduce/reduce_app.cpp +++ b/isis/src/base/apps/reduce/reduce_app.cpp @@ -1,3 +1,4 @@ +#include "Application.h" #include "IException.h" #include "IString.h" #include "ProcessByLine.h" @@ -85,9 +86,7 @@ namespace Isis{ p.EndProcess(); // Write the results to the log - if (log){ - log->addLogGroup(results); - } + Application::Log(results); } // REFORMAT THESE ERRORS INTO ISIS TYPES AND RETHROW catch (IException &) { throw; diff --git a/isis/src/base/apps/ringsautomos/ringsautomos.cpp b/isis/src/base/apps/ringsautomos/ringsautomos.cpp index a9a34cb238..ad8f0d1ad5 100644 --- a/isis/src/base/apps/ringsautomos/ringsautomos.cpp +++ b/isis/src/base/apps/ringsautomos/ringsautomos.cpp @@ -1,3 +1,4 @@ +#include "Application.h" #include "ProcessMapMosaic.h" #include "FileList.h" #include "IException.h" @@ -79,9 +80,7 @@ namespace Isis { if (!m.StartProcess(list[i].toString())) { PvlGroup outsiders("Outside"); outsiders += PvlKeyword("File", list[i].toString()); - if(log) { - log->addLogGroup(outsiders); - } + Application::Log(outsiders); } else { mosaicCreated = true; @@ -96,9 +95,7 @@ namespace Isis { } // Logs the input file location in the mosaic for (int i = 0; i < m.imagePositions().groups(); i++) { - if(log) { - log->addLogGroup(m.imagePositions().group(i)); - } + Application::Log(m.imagePositions().group(i)); } if(olistFlag) { diff --git a/isis/src/base/apps/shadow/shadow.cpp b/isis/src/base/apps/shadow/shadow.cpp index 989d0c2131..337f5aa252 100644 --- a/isis/src/base/apps/shadow/shadow.cpp +++ b/isis/src/base/apps/shadow/shadow.cpp @@ -128,9 +128,7 @@ namespace Isis { functorLogData += kernelsUsed; } - if (log) { - log->addLogGroup(functorLogData); - } + Application::AppendAndLog(functorLogData, log); // Look for shape model object and remove it from output Pvl &outputCubeLabel = *outputCube->label(); diff --git a/isis/src/base/apps/skypt/skypt.cpp b/isis/src/base/apps/skypt/skypt.cpp index fed841fad2..3d8ca330d5 100644 --- a/isis/src/base/apps/skypt/skypt.cpp +++ b/isis/src/base/apps/skypt/skypt.cpp @@ -11,6 +11,7 @@ find files of those names at the top level of this repository. **/ #include #include +#include "Application.h" #include "Brick.h" #include "Camera.h" #include "CSMCamera.h" @@ -85,7 +86,7 @@ namespace Isis{ } //Write the group to the screen - log->addLogGroup(sp); + Application::AppendAndLog(sp, log); // Write an output label file if necessary if (ui.WasEntered("TO")) { diff --git a/isis/src/base/apps/spiceinit/spiceinit.cpp b/isis/src/base/apps/spiceinit/spiceinit.cpp index 48b6aac907..cd9f23d493 100644 --- a/isis/src/base/apps/spiceinit/spiceinit.cpp +++ b/isis/src/base/apps/spiceinit/spiceinit.cpp @@ -6,6 +6,7 @@ #include #include +#include "Application.h" #include "Camera.h" #include "CameraFactory.h" #include "FileName.h" @@ -472,10 +473,7 @@ namespace Isis { currentKernels += source; icube->putGroup(currentKernels); - if (log){ - log->addLogGroup(currentKernels); - } - + Application::Log(currentKernels); } catch(IException &e) { Pvl errPvl = e.toPvl(); @@ -483,9 +481,7 @@ namespace Isis { if (errPvl.groups() > 0) { currentKernels += PvlKeyword("Error", errPvl.group(errPvl.groups() - 1)["Message"][0]); } - if (log) { - log->addLogGroup(currentKernels); - } + Application::Log(currentKernels); icube->putGroup(originalKernels); // restore CSM State blob if spiceinit failed @@ -689,9 +685,7 @@ namespace Isis { icube->putGroup(kernelsGroup); - if (log) { - log->addLogGroup(kernelsGroup); - } + Application::Log(kernelsGroup); Pvl *icubeLabel = icube->label(); diff --git a/isis/src/base/apps/spiceserver/spiceserver.cpp b/isis/src/base/apps/spiceserver/spiceserver.cpp index f1c6519315..8399ada9e7 100644 --- a/isis/src/base/apps/spiceserver/spiceserver.cpp +++ b/isis/src/base/apps/spiceserver/spiceserver.cpp @@ -8,6 +8,7 @@ #include #include +#include "Application.h" #include "Blob.h" #include "Camera.h" #include "CameraFactory.h" @@ -438,9 +439,7 @@ namespace Isis { if (errPvl.groups() > 0) currentKernels += PvlKeyword("Error", errPvl.group(errPvl.groups() - 1)["Message"][0]); - if (log) { - log->addLogGroup(currentKernels); - } + Application::Log(currentKernels); throw e; } Table ckTable = cam->instrumentRotation()->Cache("InstrumentPointing"); diff --git a/isis/src/base/apps/spkwriter/spkwriter.cpp b/isis/src/base/apps/spkwriter/spkwriter.cpp index e4dd01d534..ed653a3e04 100644 --- a/isis/src/base/apps/spkwriter/spkwriter.cpp +++ b/isis/src/base/apps/spkwriter/spkwriter.cpp @@ -4,6 +4,7 @@ #include #include +#include "Application.h" #include "IException.h" #include "FileList.h" #include "Cube.h" @@ -91,7 +92,7 @@ namespace Isis { PvlGroup overlap = overrors.group(i); overlap.setName("Overlaps"); overlap.addKeyword(PvlKeyword("Class", "WARNING"), PvlContainer::Replace); - log->addLogGroup(overlap); + Application::AppendAndLog(overlap, log); } } diff --git a/isis/src/base/apps/stretch/stretch_app.cpp b/isis/src/base/apps/stretch/stretch_app.cpp index 0ad2b9759c..0c6a28ed89 100644 --- a/isis/src/base/apps/stretch/stretch_app.cpp +++ b/isis/src/base/apps/stretch/stretch_app.cpp @@ -1,3 +1,4 @@ +#include "Application.h" #include "TextFile.h" #include "Statistics.h" #include "ProcessByLine.h" @@ -82,9 +83,7 @@ namespace Isis { PvlGroup results = PvlGroup("Results"); results.addKeyword(dnPairs); - if (log){ - log->addLogGroup(results); - } + Application::Log(results); } // Line processing routine diff --git a/isis/src/base/objs/Application/Application.cpp b/isis/src/base/objs/Application/Application.cpp index 03561d18de..99b011bba1 100644 --- a/isis/src/base/objs/Application/Application.cpp +++ b/isis/src/base/objs/Application/Application.cpp @@ -14,8 +14,6 @@ find files of those names at the top level of this repository. **/ extern int errno; #include -//#include -//#include #include #include @@ -28,12 +26,9 @@ extern int errno; #include #include "Application.h" -#include "Constants.h" //is this still used in this class? -#include "CubeManager.h" #include "FileName.h" #include "IException.h" #include "IString.h" -#include "Gui.h" //is this still used? #include "Message.h" #include "Preference.h" #include "ProgramLauncher.h" @@ -387,6 +382,21 @@ namespace Isis { blankLine = true; } + /** + * Writes the pvl group results to both a passed in Pvl log and + * the applications log (either GUI or command line) + * + * @param results Pvl containing the results to add to the session log + * @param log App log for running in code + * + */ + void Application::AppendAndLog(PvlGroup &results, Pvl *log) { + Application::Log(results); + if (log) { + log->addGroup(results); + } + } + /** * Writes the Pvl results to the sessionlog, but not to the printfile * @@ -625,6 +635,12 @@ namespace Isis { */ int Application::FunctionError(IException &e) { Pvl errors = e.toPvl(); + for (int i = 0; i < errors.groups(); i++) { + PvlGroup &group = errors.group(i); + if (group.isNamed("Error")) { + group += PvlKeyword("Program", Application::Name()); + } + } SessionLog::TheLog().AddError(errors); SessionLog::TheLog().Write(); @@ -632,13 +648,13 @@ namespace Isis { SendParentErrors(errors); } else if (p_ui->IsInteractive()) { - p_ui->TheGui()->LoadMessage(e.toString()); + p_ui->TheGui()->LoadMessage(Application::formatError(e)); } else if (SessionLog::TheLog().TerminalOutput()) { cerr << SessionLog::TheLog() << endl; } else { - cerr << e.toString() << endl; + cerr << Application::formatError(e) << endl; } // If debugging flag on write debugging log @@ -706,7 +722,7 @@ namespace Isis { * @param e The Isis::iException */ void Application::GuiReportError(IException &e) { - QString errorMessage = e.toString(); + QString errorMessage = Application::formatError(e); if (errorMessage == "") { p_ui->TheGui()->ProgressText("Stopped"); } @@ -719,6 +735,29 @@ namespace Isis { exit(0); } + QString Application::formatError(IException &e) { + stringstream stringStream; + QString stringErrors = e.toString(Preference::Preferences().reportFileLine()); + + if (Preference::Preferences().outputErrorAsPvl()) { + stringStream << stringErrors; + Pvl errors; + stringStream >> errors; + for (int i = 0; i < errors.groups(); i++) { + PvlGroup &group = errors.group(i); + if (group.isNamed("Error")) { + group += PvlKeyword("Program", Application::Name()); + } + } + stringStream.str(std::string()); + stringStream.clear(); + stringStream << errors; + stringErrors = stringStream.str().c_str(); + } + + return stringErrors; + } + QString Application::p_appName("Unknown"); //!< /** * Returns the name of the application. Returns 'Unknown' if the application diff --git a/isis/src/base/objs/Application/Application.h b/isis/src/base/objs/Application/Application.h index 1106853428..e1646734d1 100644 --- a/isis/src/base/objs/Application/Application.h +++ b/isis/src/base/objs/Application/Application.h @@ -109,10 +109,12 @@ namespace Isis { static UserInterface &GetUserInterface(); static void Log(PvlGroup &results); + static void AppendAndLog(PvlGroup &results, Pvl *log); static void GuiLog(const Pvl &results); static void GuiLog(const PvlGroup &results); static void GuiLog(const QString &results); static QString Name(); + static QString formatError(IException &e); static bool p_applicationForceGuiApp; diff --git a/isis/src/base/objs/Application/Application.truth b/isis/src/base/objs/Application/Application.truth index fe22751b19..c17b1022dc 100644 --- a/isis/src/base/objs/Application/Application.truth +++ b/isis/src/base/objs/Application/Application.truth @@ -6,12 +6,12 @@ Group = Accounting End_Group Object = unittest - IsisVersion = "4.4.0 | 2021-02-19" + IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 - ProgramPath = /Users/kelvin/repos/isisbuild/unitTest - ExecutionDateTime = 2021-02-19T15:42:42 - HostName = Unknown - UserName = kelvin + ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest + ExecutionDateTime = 2023-07-18T16:56:19 + HostName = x86_64-apple-darwin13.4.0 + UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters @@ -35,13 +35,24 @@ In myFunct **PROGRAMMER ERROR** testing an error. +**PROGRAMMER ERROR** local test error. +Group = Error + Class = "PROGRAMMER ERROR" + Code = 3 + Message = "local test error" + File = unitTest.cpp + Line = 27 + Program = ./unitTest +End_Group +End + Object = unittest - IsisVersion = "4.4.0 | 2021-02-19" + IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 - ProgramPath = /Users/kelvin/repos/isisbuild/unitTest - ExecutionDateTime = 2021-02-19T15:42:42 - HostName = Unknown - UserName = kelvin + ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest + ExecutionDateTime = 2023-07-18T16:56:19 + HostName = x86_64-apple-darwin13.4.0 + UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters @@ -64,12 +75,12 @@ Object = unittest End_Object Object = unittest - IsisVersion = "4.4.0 | 2021-02-19" + IsisVersion = "7.2.0 | 2023-07-18" ProgramVersion = 2011-08-19 - ProgramPath = /Users/kelvin/repos/isisbuild/unitTest - ExecutionDateTime = 2021-02-19T15:42:42 - HostName = Unknown - UserName = kelvin + ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest + ExecutionDateTime = 2023-07-18T16:56:19 + HostName = x86_64-apple-darwin13.4.0 + UserName = acpaquette Description = "Unit test for Application class" Group = UserParameters @@ -91,12 +102,49 @@ Object = unittest End_Group Group = Error + Class = "PROGRAMMER ERROR" + Code = 3 + Message = "testing an error" + File = unitTest.cpp + Line = 22 Program = ./unitTest + End_Group +End_Object + +Object = unittest + IsisVersion = "7.2.0 | 2023-07-18" + ProgramVersion = 2011-08-19 + ProgramPath = /Users/acpaquette/repos/ISIS3/pvl_build/unitTest + ExecutionDateTime = 2023-07-18T16:56:19 + HostName = x86_64-apple-darwin13.4.0 + UserName = acpaquette + Description = "Unit test for Application class" + + Group = UserParameters + FROM = unitTest.cub + TO = $temporary/isisprocess_01.cub + TO2 = $temporary/isisprocess_02.cub + TO3 = $temporary/isisprocess_03.cub + TO4 = $temporary/isisprocess_04.cub + End_Group + + Group = Accounting + ConnectTime = 00:00:00.0 + CpuTime = 00:00:00.0 + End_Group + + Group = Accounting + ConnectTime = 00:00:00.0 + CpuTime = 00:00:00.0 + End_Group + + Group = Error Class = "PROGRAMMER ERROR" Code = 3 Message = "testing an error" File = unitTest.cpp Line = 22 + Program = ./unitTest End_Group End_Object End diff --git a/isis/src/base/objs/Application/unitTest.cpp b/isis/src/base/objs/Application/unitTest.cpp index cdcf33155c..a6778cd3a2 100644 --- a/isis/src/base/objs/Application/unitTest.cpp +++ b/isis/src/base/objs/Application/unitTest.cpp @@ -22,6 +22,24 @@ void myError() { throw Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); } +void errorFormatting() { + QString msg = "local test error"; + Isis::IException exception = Isis::IException(Isis::IException::Programmer, msg, _FILEINFO_); + + // Add test for formatError + Isis::Pvl &prefs = Isis::Preference::Preferences(); + Isis::PvlGroup &errorPrefs = prefs.findGroup("ErrorFacility"); + + QString errorString = Isis::Application::formatError(exception); + std::cout << errorString.toStdString() << std::endl; + + QString &formatValue = errorPrefs["Format"][0]; + formatValue = "Pvl"; + + errorString = Isis::Application::formatError(exception); + std::cout << errorString.toStdString() << std::endl; +} + using namespace std; int main(int argc, char *argv[]) { Isis::Preference::Preferences(true); @@ -62,6 +80,9 @@ int main(int argc, char *argv[]) { a.Run(myError); std::cout << std::endl; + a.Run(errorFormatting); + std::cout << std::endl; + Isis::Pvl p("print.prt"); std::cout << p << std::endl; diff --git a/isis/src/base/objs/IException/IException.cpp b/isis/src/base/objs/IException/IException.cpp index 223c5ce153..cd42a87e53 100644 --- a/isis/src/base/objs/IException/IException.cpp +++ b/isis/src/base/objs/IException/IException.cpp @@ -533,18 +533,7 @@ namespace Isis { * @return a string representation of this exception */ QString IException::toString() const { - bool reportFileLine = true; - - if (Preference::Preferences().hasGroup("ErrorFacility")) { - PvlGroup &errorFacility = - Preference::Preferences().findGroup("ErrorFacility"); - if (errorFacility.hasKeyword("FileLine")) { - QString fileLine = errorFacility["FileLine"][0]; - reportFileLine = (fileLine.toUpper() == "ON"); - } - } - - return toString(reportFileLine); + return toString(Preference::Preferences().reportFileLine()); } @@ -562,18 +551,7 @@ namespace Isis { QString IException::toString(bool includeFileInfo) const { QString result; - bool usePvlFormat = false; - - if (Preference::Preferences().hasGroup("ErrorFacility")) { - PvlGroup &errorFacility = - Preference::Preferences().findGroup("ErrorFacility"); - if (errorFacility.hasKeyword("Format")) { - QString format = errorFacility["Format"][0]; - usePvlFormat = (format.toUpper() == "PVL"); - } - } - - if (usePvlFormat) { + if (Preference::Preferences().outputErrorAsPvl()) { Pvl errors = toPvl(); if (errors.groups() != 0) { diff --git a/isis/src/base/objs/Preference/Preference.cpp b/isis/src/base/objs/Preference/Preference.cpp index 6a010cffad..fc54817062 100644 --- a/isis/src/base/objs/Preference/Preference.cpp +++ b/isis/src/base/objs/Preference/Preference.cpp @@ -124,6 +124,35 @@ namespace Isis { return *p_preference; } + bool Preference::outputErrorAsPvl() { + bool usePvlFormat = false; + try { + PvlGroup &errorFacility = this->findGroup("ErrorFacility"); + if (errorFacility.hasKeyword("Format")) { + QString format = errorFacility["Format"][0]; + usePvlFormat = (format.toUpper() == "PVL"); + } + } + catch (IException &e) { + // If we failed we likely don't have an ErrorFacility group + } + return usePvlFormat; + } + + bool Preference::reportFileLine() { + bool reportFileLine = true; + + if (this->hasGroup("ErrorFacility")) { + PvlGroup &errorFacility = this->findGroup("ErrorFacility"); + if (errorFacility.hasKeyword("FileLine")) { + QString fileLine = errorFacility["FileLine"][0]; + reportFileLine = (fileLine.toUpper() == "ON"); + } + } + + return reportFileLine; + } + void Preference::Shutdown() { if(p_preference) { delete p_preference; diff --git a/isis/src/base/objs/Preference/Preference.h b/isis/src/base/objs/Preference/Preference.h index ce102a6fa3..81e05291d7 100644 --- a/isis/src/base/objs/Preference/Preference.h +++ b/isis/src/base/objs/Preference/Preference.h @@ -71,6 +71,9 @@ namespace Isis { return p_unitTest; } + bool outputErrorAsPvl(); + bool reportFileLine(); + static Preference &Preferences(bool unitTest = false); private: diff --git a/isis/src/base/objs/PvlObject/PvlObject.cpp b/isis/src/base/objs/PvlObject/PvlObject.cpp index b1c0548a36..39b92c174f 100644 --- a/isis/src/base/objs/PvlObject/PvlObject.cpp +++ b/isis/src/base/objs/PvlObject/PvlObject.cpp @@ -12,7 +12,6 @@ find files of those names at the top level of this repository. **/ #include "IString.h" #include "Message.h" #include "PvlFormat.h" -#include "Application.h" #include @@ -151,19 +150,6 @@ namespace Isis { throw IException(IException::Unknown, msg, _FILEINFO_); } - /** - * Add a group to the object and report it to the log/terminal. - * - * @param group The PvlGroup object to add. - */ - void PvlObject::addLogGroup(Isis::PvlGroup &group) { - addGroup(group); - Application::Log(group); - QString msg = "This function(PvlObject::addLogGroup) will be depreciated in ISIS3 v9.0 in " - "favor of Application::appendLogGroup"; - std::cerr << msg << std::endl; - }; - /** * Finds a keyword in the current PvlObject, or deeper inside * other PvlObjects and Pvlgroups within this one. Note: This diff --git a/isis/src/base/objs/PvlObject/PvlObject.h b/isis/src/base/objs/PvlObject/PvlObject.h index 159b9bb93a..6e76ad7a56 100644 --- a/isis/src/base/objs/PvlObject/PvlObject.h +++ b/isis/src/base/objs/PvlObject/PvlObject.h @@ -188,8 +188,6 @@ namespace Isis { //m_groups[m_groups.size()-1].SetFileName(FileName()); }; - void addLogGroup(Isis::PvlGroup &group); - using PvlContainer::operator+=; void operator+= (const Isis::PvlGroup &group) { addGroup(group); diff --git a/isis/src/cassini/apps/ciss2isis/ciss2isis.cpp b/isis/src/cassini/apps/ciss2isis/ciss2isis.cpp index 4a083b040e..b49e50e9b1 100644 --- a/isis/src/cassini/apps/ciss2isis/ciss2isis.cpp +++ b/isis/src/cassini/apps/ciss2isis/ciss2isis.cpp @@ -3,6 +3,7 @@ #include +#include "Application.h" #include "CisscalFile.h" #include "FileName.h" #include "IException.h" @@ -361,9 +362,7 @@ namespace Isis{ else { PvlGroup msgGrp("Warnings"); msgGrp += PvlKeyword("CameraAngleLookup", "Failed! No Camera information for filter combination: " + filter); - if (log) { - log->addLogGroup(msgGrp); - } + Application::Log(msgGrp); bandBin += PvlKeyword("Center", "None found for filter combination."); bandBin += PvlKeyword("Width", "None found for filter combination."); } diff --git a/isis/src/control/apps/autoseed/autoseed.cpp b/isis/src/control/apps/autoseed/autoseed.cpp index 01868df404..7be0d37bf5 100644 --- a/isis/src/control/apps/autoseed/autoseed.cpp +++ b/isis/src/control/apps/autoseed/autoseed.cpp @@ -486,17 +486,13 @@ namespace Isis { PvlGroup pluginInfo = seeder->PluginParameters("SeedDefinition"); pluginInfo.addKeyword(PvlKeyword("MaxIncidence", toString(maxIncidence))); pluginInfo.addKeyword(PvlKeyword("MaxEmission", toString(maxEmission))); - if (log) { - log->addLogGroup(pluginInfo); - } + Application::Log(pluginInfo); // inform user of any unused (invalid) keywords found in the def file if (unusedDefKeywords.keywords() != 0) { PvlGroup unusedKeywords(unusedDefKeywords); unusedKeywords.setName("InvalidKeyordsFoundInDefFile"); - if (log) { - log->addLogGroup(unusedKeywords); - } + Application::Log(unusedKeywords); } // calc # of points and measures for results group in print.prt @@ -517,9 +513,7 @@ namespace Isis { resultsGrp.addKeyword(msCountKeyword); resultsGrp.addKeyword(cpIgnoredCountKeyword); resultsGrp.addKeyword(cmIgnoredCountKeyword); - if (log) { - log->addLogGroup(resultsGrp); - } + Application::Log(resultsGrp); if (seedDomain == XY) { delete proj; diff --git a/isis/src/control/apps/cnetcheck/cnetcheck.cpp b/isis/src/control/apps/cnetcheck/cnetcheck.cpp index 2a200796ce..d36a92da58 100644 --- a/isis/src/control/apps/cnetcheck/cnetcheck.cpp +++ b/isis/src/control/apps/cnetcheck/cnetcheck.cpp @@ -25,6 +25,7 @@ find files of those names at the top level of this repository. **/ #include #include +#include "Application.h" #include "Camera.h" #include "CameraFactory.h" #include "ControlMeasure.h" @@ -457,9 +458,7 @@ namespace Isis { "----------------------------------------" << endl << endl; QString logstr = ss.str().c_str(); - if (log){ - log->addLogGroup(results); - } + Application::AppendAndLog(results, log); if (!ui.IsInteractive()) { std::cout << ss.str(); diff --git a/isis/src/control/apps/cnetcombinept/cnetcombinept.cpp b/isis/src/control/apps/cnetcombinept/cnetcombinept.cpp index d6463c03d4..2f762786ff 100644 --- a/isis/src/control/apps/cnetcombinept/cnetcombinept.cpp +++ b/isis/src/control/apps/cnetcombinept/cnetcombinept.cpp @@ -487,20 +487,18 @@ namespace Isis{ } // Write out a report - if (log) { - int pMerged = validPoints - vPoints; - PvlGroup summary("Summary"); - summary += PvlKeyword("TotalCubes", toString(cube_measures_size)); - summary += PvlKeyword("TotalInputPoints", toString(all_points.size())); - summary += PvlKeyword("TotalOutputPoints", toString(oPoints)); - summary += PvlKeyword("PointsMerged", toString(pMerged)); - summary += PvlKeyword("PointsEvaluated", toString(nfound)); - summary += PvlKeyword("TotalMeasures", toString(allPoints)); - summary += PvlKeyword("MeasuresMerged", toString(nMerged)); - summary += PvlKeyword("MeasuresDeleted", toString(nRemoved)); - summary += PvlKeyword("MinimumMeasures", toString(nMinMeasures)); - log->addLogGroup(summary); - } + int pMerged = validPoints - vPoints; + PvlGroup summary("Summary"); + summary += PvlKeyword("TotalCubes", toString(cube_measures_size)); + summary += PvlKeyword("TotalInputPoints", toString(all_points.size())); + summary += PvlKeyword("TotalOutputPoints", toString(oPoints)); + summary += PvlKeyword("PointsMerged", toString(pMerged)); + summary += PvlKeyword("PointsEvaluated", toString(nfound)); + summary += PvlKeyword("TotalMeasures", toString(allPoints)); + summary += PvlKeyword("MeasuresMerged", toString(nMerged)); + summary += PvlKeyword("MeasuresDeleted", toString(nRemoved)); + summary += PvlKeyword("MinimumMeasures", toString(nMinMeasures)); + Application::Log(summary); pbl.EndProcess(); } diff --git a/isis/src/control/apps/cnetdiff/cnetdiff.cpp b/isis/src/control/apps/cnetdiff/cnetdiff.cpp index 3dd9c78660..cdc7b9b7d4 100644 --- a/isis/src/control/apps/cnetdiff/cnetdiff.cpp +++ b/isis/src/control/apps/cnetdiff/cnetdiff.cpp @@ -13,6 +13,7 @@ find files of those names at the top level of this repository. **/ #include #include +#include "Application.h" #include "ControlNet.h" #include "ControlNetDiff.h" #include "ControlNetVersioner.h" @@ -106,7 +107,7 @@ namespace Isis { differences += PvlKeyword("Reason", differenceReason); } - log.addLogGroup(differences); + Application::AppendAndLog(differences, &log); if (ui.WasEntered("TO")) log.write(ui.GetFileName("TO")); @@ -137,7 +138,7 @@ namespace Isis { if (differences.hasKeyword("Filename")) count--; results += PvlKeyword("Compare", count > 0 ? "Different" : "Identical"); - log.addLogGroup(results); + Application::AppendAndLog(results, &log); return log; } } diff --git a/isis/src/control/apps/cnetedit/cnetedit.cpp b/isis/src/control/apps/cnetedit/cnetedit.cpp index 2e290ddafd..ab7314004d 100644 --- a/isis/src/control/apps/cnetedit/cnetedit.cpp +++ b/isis/src/control/apps/cnetedit/cnetedit.cpp @@ -14,6 +14,7 @@ find files of those names at the top level of this repository. **/ #include #include +#include "Application.h" #include "ControlMeasure.h" #include "ControlNet.h" #include "ControlNetValidMeasure.h" @@ -335,7 +336,7 @@ namespace Isis { Pvl pvlResults; pvlTemplate.validatePvl(defFile, pvlResults); if (pvlResults.groups() > 0 || pvlResults.keywords() > 0) { - results.addLogGroup(pvlResults.group(0)); + Application::AppendAndLog(pvlResults.group(0), &results); QString sErrMsg = "Invalid Deffile\n"; throw IException(IException::User, sErrMsg, _FILEINFO_); @@ -355,7 +356,7 @@ namespace Isis { } // Log the DEFFILE to the print file - results.addLogGroup(defFile.findGroup("ValidMeasure", Pvl::Traverse)); + Application::AppendAndLog(defFile.findGroup("ValidMeasure", Pvl::Traverse), &results); } } diff --git a/isis/src/control/apps/cnetextract/cnetextract.cpp b/isis/src/control/apps/cnetextract/cnetextract.cpp index 2c23c1e6f5..74e2d9b9c4 100644 --- a/isis/src/control/apps/cnetextract/cnetextract.cpp +++ b/isis/src/control/apps/cnetextract/cnetextract.cpp @@ -8,6 +8,8 @@ find files of those names at the top level of this repository. **/ #include "cnetextract.h" +#include "Application.h" + using namespace std; namespace Isis { @@ -397,9 +399,7 @@ namespace Isis { outProgress.CheckStatus(); // Log Control Net results - if (log){ - log->addLogGroup(summary); - } + Application::AppendAndLog(summary, log); outProgress.CheckStatus(); @@ -503,9 +503,8 @@ namespace Isis { results.addComment("Each keyword represents a filter parameter used. " "Check the documentation for specific keyword descriptions."); } - if(log) { - log->addLogGroup(results); - } + Application::AppendAndLog(results, log); + resultsProgress.CheckStatus(); } diff --git a/isis/src/control/apps/cnetstats/cnetstats.cpp b/isis/src/control/apps/cnetstats/cnetstats.cpp index 77ccf007da..50dbb70966 100644 --- a/isis/src/control/apps/cnetstats/cnetstats.cpp +++ b/isis/src/control/apps/cnetstats/cnetstats.cpp @@ -7,6 +7,7 @@ find files of those names at the top level of this repository. **/ /* SPDX-License-Identifier: CC0-1.0 */ #include "cnetstats.h" +#include "Application.h" #include "ControlNetFilter.h" #include "ControlNetStatistics.h" #include "IException.h" @@ -66,7 +67,7 @@ namespace Isis{ for (int i=0; iaddLogGroup(pvlObj.group(j)); + Application::AppendAndLog(pvlObj.group(j), log); } } @@ -78,7 +79,7 @@ namespace Isis{ for (int i=0; iaddLogGroup(pvlObj.group(j)); + Application::AppendAndLog(pvlObj.group(j), log); } } QString sErrMsg = "Invalid Deffile\n"; @@ -108,7 +109,7 @@ namespace Isis{ // Log the summary of the input Control Network PvlGroup statsGrp; cNetFilter.GenerateControlNetStats(statsGrp); - log->addLogGroup(statsGrp); + Application::AppendAndLog(statsGrp, log); // Run Filters using Deffile if (ui.WasEntered("DEFFILE")) { diff --git a/isis/src/control/apps/cnetthinner/cnetthinner.cpp b/isis/src/control/apps/cnetthinner/cnetthinner.cpp index 75a789d0f0..524a9faade 100644 --- a/isis/src/control/apps/cnetthinner/cnetthinner.cpp +++ b/isis/src/control/apps/cnetthinner/cnetthinner.cpp @@ -9,6 +9,7 @@ find files of those names at the top level of this repository. **/ #include +#include "Application.h" #include "CnetManager.h" #include "CnetSuppression.h" #include "FileName.h" @@ -106,7 +107,7 @@ namespace Isis { results += PvlKeyword("Saved", toString(nsaved) ); results += PvlKeyword("Suppressed", toString(nremoved) ); results += PvlKeyword("Efficiency", toString(efficiency, 4), "percent" ); - log.addLogGroup(results); + Application::AppendAndLog(results, &log); p.EndProcess(); diff --git a/isis/src/control/apps/findfeatures/findfeatures.cpp b/isis/src/control/apps/findfeatures/findfeatures.cpp index dc52526641..115c2a4a18 100644 --- a/isis/src/control/apps/findfeatures/findfeatures.cpp +++ b/isis/src/control/apps/findfeatures/findfeatures.cpp @@ -225,7 +225,7 @@ namespace Isis { // Log parameters loaded from the PARAMETERS file if ( log ) { auto parmgrp = pvlmap_to_group( parms, "Parameters"); - log->addLogGroup( parmgrp ); + Application::AppendAndLog(parmgrp, log); } } @@ -274,14 +274,14 @@ namespace Isis { // Load values parsed from the GLOBALS string if ( log ) { auto globalgrp = pvlmap_to_group( globals, "Globals"); - log->addLogGroup( globalgrp ); + Application::AppendAndLog(globalgrp, log); } } // Now report the list of all global parameters in the pool if ( log ) { auto gpool = pvlmap_to_group( factory->globalParameters(), "GlobalParameterPool"); - log->addLogGroup( gpool ); + Application::AppendAndLog(gpool, log); } // Create a list of algorithm specifications from user specs and log it @@ -454,10 +454,7 @@ namespace Isis { toString(quality.StandardDeviation())); } - if(log){ - log->addLogGroup(bestinfo); - } - + Application::Log(bestinfo); // If a cnet file was entered, write the ControlNet file of the specified // type. Note that it was created as an image-to-image network. Must make @@ -501,9 +498,7 @@ namespace Isis { // Write out control network cnet.Write( ui.GetFileName("ONET") ); - if(log){ - log->addLogGroup(cnetinfo); - } + Application::Log(cnetinfo); } // If user wants a list of matched images, write the list to the TOLIST filename diff --git a/isis/src/control/apps/jigsaw/jigsaw.cpp b/isis/src/control/apps/jigsaw/jigsaw.cpp index 57f39a6370..1fc4f01138 100644 --- a/isis/src/control/apps/jigsaw/jigsaw.cpp +++ b/isis/src/control/apps/jigsaw/jigsaw.cpp @@ -14,6 +14,7 @@ find files of those names at the top level of this repository. **/ #include #include +#include "Application.h" #include "Blob.h" #include "BundleAdjust.h" #include "BundleObservationSolveSettings.h" @@ -71,9 +72,7 @@ namespace Isis { under review and is likely resulting \ in addition error in the bundle adjust. \ We recommend that you do not solve for radii at this moment.")); - if(log) { - log->addLogGroup(radiusSolveWarning); - } + Application::Log(radiusSolveWarning); } } settings->setCubeList(cubeList); @@ -202,17 +201,17 @@ namespace Isis { else { gp += PvlKeyword("Status", "Camera pointing NOT updated"); } - if (log) { - Pvl summary; - std::istringstream iss (bundleAdjustment->iterationSummaryGroup().toStdString()); - iss >> summary; - for (auto grpIt = summary.beginGroup(); grpIt!= summary.endGroup(); grpIt++) { - log->addLogGroup(*grpIt); - } + Pvl summary; + std::istringstream iss (bundleAdjustment->iterationSummaryGroup().toStdString()); + iss >> summary; - log->addLogGroup(gp); + for (auto grpIt = summary.beginGroup(); grpIt!= summary.endGroup(); grpIt++) { + Application::Log(*grpIt); } + + Application::Log(gp); + delete bundleSolution; } catch(IException &e) { diff --git a/isis/src/control/apps/pointreg/pointreg.cpp b/isis/src/control/apps/pointreg/pointreg.cpp index a48138b4c2..92f648d7ac 100644 --- a/isis/src/control/apps/pointreg/pointreg.cpp +++ b/isis/src/control/apps/pointreg/pointreg.cpp @@ -10,6 +10,7 @@ find files of those names at the top level of this repository. **/ #include "pointreg.h" +#include "Application.h" #include "AutoReg.h" #include "AutoRegFactory.h" #include "Camera.h" @@ -24,7 +25,6 @@ find files of those names at the top level of this repository. **/ #include "Progress.h" #include "SerialNumberList.h" #include "UserInterface.h" -#include "Application.h" #include "IException.h" #include "iTime.h" @@ -469,25 +469,25 @@ namespace Isis { PvlGroup pLog("Points"); pLog += PvlKeyword("Total", toString(outNet.GetNumPoints())); pLog += PvlKeyword("Ignored", toString(ignored)); - appLog->addLogGroup(pLog); + Application::AppendAndLog(pLog, appLog); PvlGroup mLog("Measures"); mLog += PvlKeyword("Locked", toString(locked)); mLog += PvlKeyword("Registered", toString(registered)); mLog += PvlKeyword("NotIntersected", toString(notintersected)); mLog += PvlKeyword("Unregistered", toString(unregistered)); - appLog->addLogGroup(mLog); + Application::AppendAndLog(mLog, appLog); // Log Registration Statistics Pvl arPvl = ar->RegistrationStatistics(); for (int i = 0; i < arPvl.groups(); i++) { - appLog->addLogGroup(arPvl.group(i)); + Application::AppendAndLog(arPvl.group(i), appLog); } // add the auto registration information to print.prt PvlGroup autoRegTemplate = ar->RegTemplate(); - appLog->addLogGroup(autoRegTemplate); + Application::AppendAndLog(autoRegTemplate, appLog); if (validator) { PvlGroup validationGroup("ValidationStatistics"); @@ -502,11 +502,11 @@ namespace Isis { } } - appLog->addLogGroup(validationGroup); + Application::AppendAndLog(validationGroup, appLog); PvlGroup validationTemplate = validator->UpdatedTemplate(); validationTemplate.setName("ValidationTemplate"); - appLog->addLogGroup(validationTemplate); + Application::AppendAndLog(validationTemplate, appLog); } outNet.Write(ui.GetFileName("ONET")); diff --git a/isis/src/control/apps/sumspice/sumspice.cpp b/isis/src/control/apps/sumspice/sumspice.cpp index 0a1354a6be..023e6e5911 100644 --- a/isis/src/control/apps/sumspice/sumspice.cpp +++ b/isis/src/control/apps/sumspice/sumspice.cpp @@ -120,9 +120,7 @@ namespace Isis { } } - if (duplicates.keywords() != 0 && log) { - log->addLogGroup(duplicates); - } + Application::Log(duplicates); // Determine the update mode QString update = ui.GetString("UPDATE").toLower(); @@ -196,9 +194,7 @@ namespace Isis { } PvlGroup loggrp("Warnings"); loggrp.addKeyword(message); - if (log){ - log->addLogGroup(loggrp); - } + Application::Log(loggrp); } diff --git a/isis/src/galileo/apps/gllssical/gllssical.cpp b/isis/src/galileo/apps/gllssical/gllssical.cpp index b806cfd0dd..6de05b1cbd 100644 --- a/isis/src/galileo/apps/gllssical/gllssical.cpp +++ b/isis/src/galileo/apps/gllssical/gllssical.cpp @@ -6,6 +6,7 @@ find files of those names at the top level of this repository. **/ /* SPDX-License-Identifier: CC0-1.0 */ +#include "Application.h" #include "ProcessByLine.h" #include "Buffer.h" #include "Camera.h" @@ -145,11 +146,9 @@ namespace Isis { } ocube->putGroup(calibrationLog); - - if(log){ - log->addLogGroup(calibrationLog); - } - + + Application::Log(calibrationLog); + p.EndProcess(); } diff --git a/isis/src/kaguya/apps/mimap2isis/mimap2isis.cpp b/isis/src/kaguya/apps/mimap2isis/mimap2isis.cpp index 93bfb6f7b3..4b21d9fb93 100644 --- a/isis/src/kaguya/apps/mimap2isis/mimap2isis.cpp +++ b/isis/src/kaguya/apps/mimap2isis/mimap2isis.cpp @@ -8,6 +8,7 @@ find files of those names at the top level of this repository. **/ #include "mimap2isis.h" +#include "Application.h" #include "FileName.h" #include "ProcessImportPds.h" @@ -121,7 +122,7 @@ namespace Isis { results.setName("Results"); results[0].addComment("Projection offsets and multipliers have been changed from"); results[0].addComment("defaults. New values are below."); - log->addLogGroup(results); + Application::Log(results); } p.EndProcess(); diff --git a/isis/src/lro/apps/lronacpho/lronacpho.cpp b/isis/src/lro/apps/lronacpho/lronacpho.cpp index 77da1b8dcd..ae0fae026b 100644 --- a/isis/src/lro/apps/lronacpho/lronacpho.cpp +++ b/isis/src/lro/apps/lronacpho/lronacpho.cpp @@ -1,3 +1,4 @@ +#include "Application.h" #include "ProcessByLine.h" #include "LROCEmpirical.h" #include "PhotometricFunction.h" @@ -140,11 +141,8 @@ namespace Isis{ g_phoFunction->report(photo); oCube->putGroup(photo); - - if(log){ - log->addLogGroup(photo); - } - //Application::Log(photo); + + Application::Log(photo); p.EndProcess(); p.ClearInputCubes(); diff --git a/isis/src/mro/apps/crism2isis/crism2isis.cpp b/isis/src/mro/apps/crism2isis/crism2isis.cpp index 9363a3bbe8..00d2176790 100644 --- a/isis/src/mro/apps/crism2isis/crism2isis.cpp +++ b/isis/src/mro/apps/crism2isis/crism2isis.cpp @@ -7,6 +7,7 @@ find files of those names at the top level of this repository. **/ /* SPDX-License-Identifier: CC0-1.0 */ #include "crism2isis.h" +#include "Application.h" #include "ProcessImportPds.h" #include "UserInterface.h" #include "Pvl.h" @@ -173,9 +174,8 @@ namespace Isis{ "Isis using crism2isis should only be interpolated " "using the nearest-neighbor algorithm due to gimble " "jitter of the MRO CRISM instrument."); - if (log){ - log->addLogGroup(results); - } + + Application::Log(results); return; } } diff --git a/isis/src/mro/apps/hi2isis/hi2isis.cpp b/isis/src/mro/apps/hi2isis/hi2isis.cpp index 4d5227487e..19b7f765e3 100644 --- a/isis/src/mro/apps/hi2isis/hi2isis.cpp +++ b/isis/src/mro/apps/hi2isis/hi2isis.cpp @@ -13,6 +13,7 @@ find files of those names at the top level of this repository. **/ #include "ProcessImportPds.h" #include "ProcessByLine.h" +#include "Application.h" #include "TableRecord.h" #include "Buffer.h" #include "Table.h" @@ -229,9 +230,7 @@ namespace Isis { results += PvlKeyword("ObservationDarkValid", toString(validCount[5])); // Write the results to the log - if(log){ - log->addLogGroup(results); - } + Application::Log(results); return; } diff --git a/isis/src/mro/apps/hicrop/hicrop.cpp b/isis/src/mro/apps/hicrop/hicrop.cpp index 6241d4b8f1..b0c66f6f73 100644 --- a/isis/src/mro/apps/hicrop/hicrop.cpp +++ b/isis/src/mro/apps/hicrop/hicrop.cpp @@ -14,6 +14,7 @@ find files of those names at the top level of this repository. **/ #include // Isis includes +#include "Application.h" #include "Buffer.h" #include "Cube.h" #include "FileName.h" @@ -371,9 +372,7 @@ namespace Isis { g_in = NULL; // Write the results to the log - if(log) { - log->addLogGroup(results); - } + Application::AppendAndLog(results, log); // Unfurnishes kernel files to prevent file table overflow NaifStatus::CheckErrors(); diff --git a/isis/src/mro/apps/marci2isis/marci2isis.cpp b/isis/src/mro/apps/marci2isis/marci2isis.cpp index b765fe4d2b..d409c07d75 100644 --- a/isis/src/mro/apps/marci2isis/marci2isis.cpp +++ b/isis/src/mro/apps/marci2isis/marci2isis.cpp @@ -226,7 +226,7 @@ namespace Isis{ " Assuming exposure time is fixed for [" + inFile.toString() + "]" ); missing.addKeyword(message); missing.addKeyword(PvlKeyword("FileNotFoundInVarexpFile", prodId), Pvl::Replace); - log->addLogGroup(missing); + Application::Log(missing); } // Translate labels to every image and close output cubes before calling EndProcess diff --git a/isis/src/system/apps/isisdataeval/isisdataeval.cpp b/isis/src/system/apps/isisdataeval/isisdataeval.cpp index 5179199072..4d21fb1c95 100644 --- a/isis/src/system/apps/isisdataeval/isisdataeval.cpp +++ b/isis/src/system/apps/isisdataeval/isisdataeval.cpp @@ -69,15 +69,6 @@ namespace Isis { }; typedef struct validation_counts ValidationCounts; - /** Add log Group to log file and console for backward compatability */ - inline void db_addLogGroup( Pvl *log, PvlGroup &group ) { - // Report translations... - // Emulates: pvl->addLogGroup( group ); - log->addGroup( group ); - Application::Log( group ); - return; - } - /** Report evaluation data consistently */ inline void report_issues( std::ostream &db_os, const Data::DBFileDispositionList &db_status, @@ -154,8 +145,7 @@ namespace Isis { } // Report translations... - // pvl->addLogGroup( prefdir ); - db_addLogGroup( log, prefdir ); + Application::AppendAndLog( prefdir, log); //******************************************************************* // Process DATADIR which will collect the inventory and evaluate @@ -422,8 +412,7 @@ namespace Isis { } // Final log - // pvl->addLogGroup( results ); - db_addLogGroup( log, results ); + Application::AppendAndLog( results, log ); eval_proc.Finalize(); return;