From 05e248b90ab3c652fa630fa948a5070606687bdd Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Wed, 18 Mar 2020 16:29:36 +0100
Subject: [PATCH] [App/ogs] Add spdlog error handler.

Helps with identification of wrong output types etc.
---
 Applications/CLI/ogs.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp
index 3ea15928f05..4e53247911c 100644
--- a/Applications/CLI/ogs.cpp
+++ b/Applications/CLI/ogs.cpp
@@ -123,6 +123,10 @@ int main(int argc, char* argv[])
 
     BaseLib::setConsoleLogLevel(log_level_arg.getValue());
     spdlog::set_pattern("%^%l:%$ %v");
+    spdlog::set_error_handler([](const std::string& msg) {
+        std::cerr << "spdlog error: " << msg << std::endl;
+        OGS_FATAL("spdlog logger error occured.");
+    });
 
     INFO("This is OpenGeoSys-6 version {:s}.",
          GitInfoLib::GitInfo::ogs_version);
-- 
GitLab