diff Applications/ApplicationToolbox.cpp @ 93:14146ecd1688

Display version of the framework in the logs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 23 Dec 2016 16:49:23 +0100
parents 3d83d34cd4db
children ff0ef01c332c
line wrap: on
line diff
--- a/Applications/ApplicationToolbox.cpp	Fri Dec 23 16:06:05 2016 +0100
+++ b/Applications/ApplicationToolbox.cpp	Fri Dec 23 16:49:23 2016 +0100
@@ -24,10 +24,13 @@
 #include "../Resources/Orthanc/Core/HttpClient.h"
 #include "../Resources/Orthanc/Core/Logging.h"
 #include "../Resources/Orthanc/Core/MultiThreading/BagOfTasksProcessor.h"
+#include "../Resources/Orthanc/Core/SystemToolbox.h"
 #include "../Resources/Orthanc/OrthancServer/FromDcmtkBridge.h"
 
+#include <boost/filesystem.hpp>
 #include <boost/lexical_cast.hpp>
 #include <boost/regex.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
 #include <cassert>
 
 
@@ -202,5 +205,27 @@
         << std::endl
         << "Written by Sebastien Jodogne <s.jodogne@gmail.com>" << std::endl;
     }
+
+
+    void ShowVersionInLog(const char* path)
+    {
+      std::string version(ORTHANC_WSI_VERSION);
+
+      if (version == "mainline")
+      {
+        try
+        {
+          boost::filesystem::path exe(Orthanc::SystemToolbox::GetPathToExecutable());
+          std::time_t creation = boost::filesystem::last_write_time(exe);
+          boost::posix_time::ptime converted(boost::posix_time::from_time_t(creation));
+          version += " (" + boost::posix_time::to_iso_string(converted) + ")";
+        }
+        catch (...)
+        {
+        }
+      }
+
+      LOG(WARNING) << "Orthanc WSI version: " << version;
+    }
   }
 }