Debug with Structured Logging

Screenshot 2023-06-06 at 20.52.59 (2).png

New debug console 

  • Message is the focus not all the prefixes.. so you can add them back in based on metadata options flag.  This now shows up below the message
  • Yellow or Red background is an error and fault
  • Can also press space on a single log entry.
  • You can also use filtering so only show what you care about, you will get auto complete view too. You can also right click on a log entry and use it to show similar or hide similar etc.

Live debugging

  • Demo 

LLDB Improvements 

  • Use p instead of po so you can get the details of an object
  • Hard to remember all the new commands.. try dwim-print (or do what I mean print), you can just use ā€œpā€ instead
  • Po will now do what I want plus customer object descriptions

Tips for logging

  • OSLog is for debugging, print is only for stdio
  • You should log any tasks being done, along with the results( 
  • You get all the meta data is you use OSLog – import OSLog in to the project.  Define your Logger with a subsystem (your app) and category (your function)
  • Consider
    • create multiple log handles for different components 
    • Use OSLogStore for collection in the field
    • OSLog is a tracing facility – it can do performance too