From 7cac481febcd934ccc4cb8dc86cbe3d387321d3e Mon Sep 17 00:00:00 2001
From: Treeve Jelbert <treeve@sourcemage.org>
Date: Sat, 13 Apr 2019 13:25:18 +0200
Subject: [PATCH 2/3] fix logging

---
 src/cpp-utils/logging/Logger.h  | 2 ++
 src/cpp-utils/logging/logging.h | 4 ++--
 src/cryfs-cli/Cli.cpp           | 8 ++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/cpp-utils/logging/Logger.h b/src/cpp-utils/logging/Logger.h
index ceff576..5851e06 100644
--- a/src/cpp-utils/logging/Logger.h
+++ b/src/cpp-utils/logging/Logger.h
@@ -7,6 +7,8 @@
 #endif

 #include <spdlog/spdlog.h>
+#include <spdlog/sinks/stdout_sinks.h>
+#include <spdlog/sinks/syslog_sink.h>
 #include "../macros.h"

 namespace cpputils {
diff --git a/src/cpp-utils/logging/logging.h b/src/cpp-utils/logging/logging.h
index aed44db..b4ae276 100644
--- a/src/cpp-utils/logging/logging.h
+++ b/src/cpp-utils/logging/logging.h
@@ -4,7 +4,7 @@

 #include "Logger.h"
 #include <stdexcept>
-#include <spdlog/fmt/ostr.h>
+#include <fmt/ostream.h>

 #if defined(_MSC_VER)
 #include <spdlog/sinks/msvc_sink.h>
@@ -75,7 +75,7 @@ namespace cpputils {
 #if defined(_MSC_VER)
           return spdlog::create<spdlog::sinks::msvc_sink_mt>(name);
 #else
-          return spdlog::syslog_logger(name, name, LOG_PID);
+          return spdlog::syslog_logger_mt(name, name, LOG_PID);
 #endif
         }
     }
diff --git a/src/cryfs-cli/Cli.cpp b/src/cryfs-cli/Cli.cpp
index 261459f..abcaa8a 100644
--- a/src/cryfs-cli/Cli.cpp
+++ b/src/cryfs-cli/Cli.cpp
@@ -4,6 +4,10 @@
 #include <cmath>
 #include <cstdio>
 #include <cstdlib>
+
+#include <spdlog/sinks/syslog_sink.h>
+#include <spdlog/sinks/basic_file_sink.h>
+
 #include <cpp-utils/assert/backtrace.h>

 #include <fspp/fuse/Fuse.h>
@@ -310,9 +314,9 @@ namespace cryfs_cli {
         //TODO Test that --logfile parameter works. Should be: file if specified, otherwise stderr if foreground, else syslog.
         if (options.logFile() != none) {
             cpputils::logging::setLogger(
-                spdlog::create<spdlog::sinks::simple_file_sink<std::mutex>>("cryfs", options.logFile()->string()));
+                spdlog::create<spdlog::sinks::basic_file_sink<std::mutex>>("cryfs", options.logFile()->string()));
         } else if (options.foreground()) {
-            cpputils::logging::setLogger(spdlog::stderr_logger_mt("cryfs"));
+            cpputils::logging::setLogger(spdlog::stderr_logger_st("cryfs"));
         } else {
             cpputils::logging::setLogger(cpputils::logging::system_logger("cryfs"));
         }
--
2.21.0
