Grabbing xcode's console data using lldb

Really new here so I apologise in advance if this question is irrelevant…
I’m trying to get Xcodes’s console’s data and copy it to a file automatically every time it spits information out. I followed Derek Selander’s tutorial on How To Create an Xcode Plugin, but I’m stuck on an issue regarding Xcode’s console, lldb and swift.
I managed to get the console’s view (IDEConsoleTextView ) memory address using Dtrace, and confirmed it with lldb - hid my output and unhid it back again… question is how do I integrate this in my code using Swift, and would this actually be the correct approach?