From 2adc42e93f0bd2ef66238443bf16c57eb0864001 Mon Sep 17 00:00:00 2001 From: Andy Galasso Date: Sat, 14 Dec 2024 00:17:13 -0500 Subject: [PATCH] Workaround for GPDebug::Log not working with format %s Add a Write mthod to GPLog for logging an already formatted C-style string. This is a workaround for GPDebug::Log not being able to handle a format string with %s. --- .../MPI_IS_gaussian_process/src/gaussian_process_guider.cpp | 1 + .../MPI_IS_gaussian_process/src/gaussian_process_guider.h | 1 + src/mount.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/contributions/MPI_IS_gaussian_process/src/gaussian_process_guider.cpp b/contributions/MPI_IS_gaussian_process/src/gaussian_process_guider.cpp index a1b35f415..e45e5e836 100644 --- a/contributions/MPI_IS_gaussian_process/src/gaussian_process_guider.cpp +++ b/contributions/MPI_IS_gaussian_process/src/gaussian_process_guider.cpp @@ -824,6 +824,7 @@ void GaussianProcessGuider::SetLearningRate(double learning_rate) class NullDebugLog : public GPDebug { void Log(const char *fmt, ...) { } + void Write(const char *what) { } }; class GPDebug *GPDebug = new NullDebugLog(); diff --git a/contributions/MPI_IS_gaussian_process/src/gaussian_process_guider.h b/contributions/MPI_IS_gaussian_process/src/gaussian_process_guider.h index 07576688a..459f47209 100644 --- a/contributions/MPI_IS_gaussian_process/src/gaussian_process_guider.h +++ b/contributions/MPI_IS_gaussian_process/src/gaussian_process_guider.h @@ -333,6 +333,7 @@ class GPDebug static void SetGPDebug(GPDebug *logger); virtual ~GPDebug(); virtual void Log(const char *format, ...) = 0; + virtual void Write(const char *what) = 0; }; extern class GPDebug *GPDebug; diff --git a/src/mount.cpp b/src/mount.cpp index 8c5fe0234..0afd86eca 100644 --- a/src/mount.cpp +++ b/src/mount.cpp @@ -699,6 +699,7 @@ static GuideAlgorithm *MakeGaussianProcessGuideAlgo(Mount *mount, GuideAxis axis Debug.Write(wxString::FormatV(format + wxString("\n"), ap)); va_end(ap); } + void Write(const char *what) { Debug.Write(wxString(what) + _T("\n")); } }; GPDebug::SetGPDebug(new PHD2DebugLogger()); s_gp_debug_inited = true;