I'm trying to modify some of the BSpline code, and I want to log some data to help me. I tried using a basic printf, but that didn't work. What is the correct idiom for logging data from C++ code?
Edit: printf did work, my code wasn't being called. I'd still like to know the correct way to do logging from C++, though.
Idiom for logging in C++ code
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 24
- Joined: Thu Sep 06, 2018 10:29 am
Re: Idiom for logging in C++ code
You can include <Base/Console.h> then use eg the FC_LOG() macro.
-
- Posts: 24
- Joined: Thu Sep 06, 2018 10:29 am
Re: Idiom for logging in C++ code
Thanks! I'll use that instead.
I'll ask another question here to keep from spamming the board with new threads:
I'm working on implementing the functionality to have a B-Spline interpolated through user-defined points, like I asked about here. OpenCASCADE has the GeomAPI_Interpolate class that I should be able to use to generate the curve from a list of points. I'm looking at how the geometry is being created, and it looks like we send the parameters from the C++ code in CommandCreateGeo.cpp to python code which calls back into the C++ code in Sketch.cpp. Here's an example of where this is done. Why is this done in such a roundabout manner instead of just calling the C++ code directly?
I'll ask another question here to keep from spamming the board with new threads:
I'm working on implementing the functionality to have a B-Spline interpolated through user-defined points, like I asked about here. OpenCASCADE has the GeomAPI_Interpolate class that I should be able to use to generate the curve from a list of points. I'm looking at how the geometry is being created, and it looks like we send the parameters from the C++ code in CommandCreateGeo.cpp to python code which calls back into the C++ code in Sketch.cpp. Here's an example of where this is done. Why is this done in such a roundabout manner instead of just calling the C++ code directly?
Re: Idiom for logging in C++ code
My guess is that it's done this way for macro recording purpose.