I am starting to link my functions now and have a lot of LLDB verbiage that I don't need to see, when all I need is the return value.
Is there a way to call a function but suppress it spitting anything out to the LLDB - essentially, I just want the resulting value, not the print statements.
Imagine checking every change on a function that performs several actions, printing out values to the LLDB before and after changes to see if they worked, then you get a lot of verbiage.
Basically, I have too much verbiage and sometimes I'd just like to suppress it because it's confusing to keep track of a function's behaviour when linking to another just for the value you need:
e.g.
func oldTest() -> Int {
print("20 lines of text")
}
func currentTest() {
var = oldTest()
print("all the text in this function")
//unfortunately all the 20 lines from the other function get printed too!
}
Are you printing things for effect? For example, you’re building a command-line tool and this forms part of the output. Or is your printing just for debugging purposes?
If it’s the former I’d change how you write your code. I tend to build my tools so that I have core code that returns a description of what the results should be, and then I have separate code to print that. This has a bunch of advantages:
It separates concerns, which is always a good thing
It allows the core code to be reused in other environments, like in a GUI app.
It helps with testing.
My core code tends to be functional — that is, its output is predictable based on solely its input parameters — which means I can see everything in the debugger.
It means I don’t have to worry about this problem (-:
In contrast, if these print statements are purely for debugging, I’m going to recommend that you take a look at Xcode’s breakpoints. You can set up a breakpoint that prints some state and then automatically continues. The Xcode UI then makes it easy to enable and disable these breakpoints, and thus enable and disable your logging.