Skip to content

Commit

Permalink
Workaround for GPDebug::Log not working with format %s
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
agalasso committed Dec 14, 2024
1 parent b81d4c6 commit 2adc42e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2adc42e

Please sign in to comment.