What is the best practice for reporting errors / events in the iPhone app?

What is the best practice for reporting errors / events in the iPhone app? I'm not talking about debugging, but after the application has been released. I mean, I would like to collect error / event logs when the application is running in released mode (not in debug mode). (If necessary, I can ask the user to voluntarily send the file to my server for analysis.)

(Does NSLog have any effect if it doesn't work in debugging? If so, where is it written? And how to clear the contents programmatically?)

+6
source share
2 answers
+1
source

I posted an answer to a similar question here: Including user data in iOS crash dumps

NSLog should not be used for detailed logging in production applications, as this slows down your application. NSLog opens a connection to the registrar every time it is called, and does it synchronously, so it blocks the current thread.

Rather, use CocoaLumberjack , which logs asynchronously, very fast, and provides log level support from errors that can even be changed at run time with some extra effort (see its wiki page). In addition, it supports several output targets, such as files, Xcode console or console, etc.

Another great NSLogger logging library that provides a Mac app for streaming log data through Bonjour. Both of these libraries can be used together, which means streaming log data from CocoaLumberjack to the NSLogger Mac application using this connector: https://github.com/steipete/NSLogger-CocoaLumberjack-connector

+3
source

Source: https://habr.com/ru/post/926593/


All Articles