How to print message to save logs c++

I’m having a huge issue with some c++ code and want to know what part of it is causing the problem. Whenever a function is called, it crashes the editor so I can’t see the output log which is the part I want to see. My main question is: how do I print a message to the save logs with c++. Thanks for your time.

In case anyone is looking for this, the editor crash reporter has a nearly invisible link (around the middle of the panel) that takes you to the directory of the last crash info, which includes the .log file.

.I believe the default location is in your project folder /Saved/Crashes.