Unverified Commit 932c8ea6 authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Logging Update (#289)

* Added and registered the log when a new plugin is being created

* Updated frame and ls models to log to a registered spdlogger only if it exists

* Updated h files in line with new named logger approach

* Fixed failing tests

* Resolved rebase changes that snuck back in

* Set default logger for framer

* Updated default logger for the framer

* Added more checks to prevent seg faults from a poorly set environment variable

* Removed try catch blocks and one register command

* Updated sensor models to carry around a pointer to the logger
parent a53f9cfe
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@
#include "Utilities.h"

#include "spdlog/spdlog.h"
#include "spdlog/sinks/basic_file_sink.h"

#include <json/json.hpp>

@@ -324,7 +323,7 @@ class UsgsAstroFrameSensorModel : public csm::RasterGM, virtual public csm::Sett
        csm::param::Set pSet = csm::param::VALID,
        const GeometricModelList &otherModels = GeometricModelList()) const;
    virtual std::shared_ptr<spdlog::logger> getLogger();
    virtual void setLogger(std::shared_ptr<spdlog::logger> logger);
    virtual void setLogger(std::string logName);
    double getValue(int index, const std::vector<double> &adjustments) const;
    void calcRotationMatrix(double m[3][3]) const;
    void calcRotationMatrix(double m[3][3], const std::vector<double> &adjustments) const;
@@ -385,8 +384,7 @@ class UsgsAstroFrameSensorModel : public csm::RasterGM, virtual public csm::Sett

    csm::EcefCoord m_referencePointXyz;

    std::string m_logFile;
    std::shared_ptr<spdlog::logger> m_logger;
    std::shared_ptr<spdlog::logger> m_logger = spdlog::get("usgscsm_logger");

    json _state;
    static const int         _NUM_STATE_KEYWORDS;
+3 −5
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
#include "Distortion.h"

#include "spdlog/spdlog.h"
#include "spdlog/sinks/basic_file_sink.h"

class UsgsAstroLsSensorModel : public csm::RasterGM, virtual public csm::SettableEllipsoid
{
@@ -64,7 +63,7 @@ public:
   static std::string getModelNameFromModelState(
      const std::string& model_state);

  std::string constructStateFromIsd(const std::string imageSupportData, csm::WarningList *list) const;
  std::string constructStateFromIsd(const std::string imageSupportData, csm::WarningList *list);

   // State data elements;
   std::string  m_imageIdentifier;
@@ -125,8 +124,7 @@ public:


   // Define logging pointer and file content
   std::string m_logFile;
   std::shared_ptr<spdlog::logger> m_logger;
   std::shared_ptr<spdlog::logger> m_logger = spdlog::get("usgscsm_logger");

   // Hardcoded
   static const std::string      _SENSOR_MODEL_NAME; // state date element 0
@@ -697,7 +695,7 @@ public:
   //<

   virtual std::shared_ptr<spdlog::logger> getLogger();
   virtual void setLogger(std::shared_ptr<spdlog::logger> logger);
   virtual void setLogger(std::string logName);


   //---
+3 −0
Original line number Diff line number Diff line
@@ -7,6 +7,9 @@
#include <Plugin.h>
#include <Version.h>

#include "spdlog/spdlog.h"
#include "spdlog/sinks/basic_file_sink.h"

#include <json/json.hpp>
using json = nlohmann::json;

+79 −94

File changed.

Preview size limit exceeded, changes collapsed.

+177 −195

File changed.

Preview size limit exceeded, changes collapsed.

Loading