From bb6995725733ed31c925e057ad72fa7ed087b8a0 Mon Sep 17 00:00:00 2001 From: ynput Date: Thu, 12 Dec 2024 15:31:42 +0100 Subject: [PATCH 1/4] updates to the constructor to handle logging input better --- src/AyonCppApi/AyonCppApi.cpp | 35 ++++++++++++++++++++++++----------- src/AyonCppApi/AyonCppApi.h | 2 +- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/AyonCppApi/AyonCppApi.cpp b/src/AyonCppApi/AyonCppApi.cpp index 231be7f..05835d4 100644 --- a/src/AyonCppApi/AyonCppApi.cpp +++ b/src/AyonCppApi/AyonCppApi.cpp @@ -33,9 +33,11 @@ #include "perfPrinter.h" // TODO implement the better Crash hanlder +// TODO this implementation dose not check for empty or invalid values. (if sideID is empty we get an http::500 while +// the error is not at the server) backward::StackTrace st; -AyonApi::AyonApi(const std::string &logFilePos, +AyonApi::AyonApi(const std::optional &logFilePos, const std::string &authKey, const std::string &serverUrl, const std::string &ayonProjectName, @@ -49,18 +51,29 @@ AyonApi::AyonApi(const std::string &logFilePos, PerfTimer("AyonApi::AyonApi"); // ----------- Init m_Logger - std::filesystem::path logFileName = "logFile.json"; - std::filesystem::path basePath = logFilePos; - std::filesystem::path logFilePath = std::filesystem::absolute(basePath) / logFileName; - if (std::filesystem::exists(logFilePath)) { - logFilePath = std::filesystem::canonical(logFilePath); - } - else { - std::filesystem::create_directories(logFilePath.parent_path()); - } + std::filesystem::path logPath; + if (logFilePos.has_value()) { + std::filesystem::path inPath(logFilePos.value()); + + if (inPath.is_relative()) { + logPath = std::filesystem::weakly_canonical(inPath); + } + if (!inPath.has_parent_path()) { + // if the input path is just an filename we will just throw it into tmp + logPath = std::filesystem::temp_directory_path() / inPath; + } + // we allways want the data to be a json, so we just enforce it. + logPath.replace_extension(".json"); - m_Log = std::make_shared(AyonLogger::getInstance(logFilePath.string())); + if (std::filesystem::exists(logPath)) { + logPath = std::filesystem::canonical(logPath); + } + else { + std::filesystem::create_directories(logPath.parent_path()); + } + } + m_Log = std::make_shared(AyonLogger::getInstance(logPath.string())); m_Log->LogLevlWarn(); m_Log->info(m_Log->key("AyonApi"), "Init AyonServer httplib::Client"); diff --git a/src/AyonCppApi/AyonCppApi.h b/src/AyonCppApi/AyonCppApi.h index 37c2e70..e8f6340 100644 --- a/src/AyonCppApi/AyonCppApi.h +++ b/src/AyonCppApi/AyonCppApi.h @@ -25,7 +25,7 @@ class AyonApi { /** * @brief constructor */ - AyonApi(const std::string &logFilePos, + AyonApi(const std::optional &logFilePos, const std::string &authKey, const std::string &serverUrl, const std::string &ayonProjectName, From cca0ca42359114f29ae8272f1068b3cb57563bf7 Mon Sep 17 00:00:00 2001 From: Tadeas Hejnic Date: Fri, 27 Mar 2026 11:18:06 +0100 Subject: [PATCH 2/4] checkout to changes --- ext/ayon-cpp-dev-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ayon-cpp-dev-tools b/ext/ayon-cpp-dev-tools index cc952de..640f05e 160000 --- a/ext/ayon-cpp-dev-tools +++ b/ext/ayon-cpp-dev-tools @@ -1 +1 @@ -Subproject commit cc952dec566b5e5d98a6e837ad687490bce3c34a +Subproject commit 640f05ed1ddaab2a938738b32dc033199f8ba04a From a0f0b55b385fe1ccff7c21edf1be2c44ba393fe3 Mon Sep 17 00:00:00 2001 From: Tadeas Hejnic Date: Fri, 27 Mar 2026 13:33:56 +0100 Subject: [PATCH 3/4] update --- ext/ayon-cpp-dev-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ayon-cpp-dev-tools b/ext/ayon-cpp-dev-tools index 640f05e..0acdf00 160000 --- a/ext/ayon-cpp-dev-tools +++ b/ext/ayon-cpp-dev-tools @@ -1 +1 @@ -Subproject commit 640f05ed1ddaab2a938738b32dc033199f8ba04a +Subproject commit 0acdf00172a5bb6bca1d81fdeae3232f18de51cf From 9f213c76b4372b1d0cd494b0d65fed08fa9efe05 Mon Sep 17 00:00:00 2001 From: Tadeas Hejnic Date: Mon, 30 Mar 2026 10:44:12 +0200 Subject: [PATCH 4/4] checkout to latest release --- ext/ayon-cpp-dev-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ayon-cpp-dev-tools b/ext/ayon-cpp-dev-tools index 0acdf00..9f647c0 160000 --- a/ext/ayon-cpp-dev-tools +++ b/ext/ayon-cpp-dev-tools @@ -1 +1 @@ -Subproject commit 0acdf00172a5bb6bca1d81fdeae3232f18de51cf +Subproject commit 9f647c0eaef710d6e5f8564f65a6091d19acc791