17

When I change to log my messages from print to os_log, it indeed provided very detail timestamp for each message. But sometimes I does not need the long timestamp information occupied screen space.

How to hide/reformat the Xcode's console or could I configure OSLog to not show timestamp for a while? Or I should use print instead?

Here is my logger use

let logger = OSLog(subsystem: "com.my.myapp", category: "MediaObj")
os_log(.debug, log: logger, "....my...message...")

enter image description here

Chen OT
  • 3,486
  • 2
  • 24
  • 46
  • Possible duplicate of [In Xcode, is there a way to disable the timestamps that appear in the debugger console when calling NSLog?](https://stackoverflow.com/questions/1354728/in-xcode-is-there-a-way-to-disable-the-timestamps-that-appear-in-the-debugger-c) – Sagar Chauhan Sep 06 '19 at 09:38
  • 6
    @SagarChauhan `NSLog` and `OSLog` are different APIs. This isn't a dupe. – Ryan Maloney Feb 12 '20 at 21:24
  • Was there any update on this? – AKIL KUMAR Mar 24 '21 at 19:31
  • 3
    I made a workaround that adding a control flag to decide 1) print to output window without timestamp using print (in debug), or 2) print to Console with full timestamp using os_log(.default, ...) (in release). – Chen OT Mar 25 '21 at 01:41

0 Answers0