Record & Share

When you're testing your application on a iOS or Android device, it's almost always connected to a debugger, but when you do not need a custom solution to view the logs, especially on iOS.

Besides, imagine a pretty common situation. Let's say that you need to send a build to an external tester or to your client. If they found a bug or a wrong behaviour, you would obviously like to see the logs for an issue investigation if the description wasn't enough (in most cases, unfortunately). But now there is a straightforward way for a client to share the logs with you.

So, that's what we're trying to solve here with our Record & Share API. First of all, in order to use that feature, you need to init the logger on your app start. Just add this call to your landing scene or to any script on start.

SA.UltimateLogger.Logger.Init ();

Now you may use the following methods to implement the logs UI inside your application.

To show all the log files UI, simply use the ShowSharingUI method. This UI will allow you to browse through all the session logs, view those logs, delete and share the desired log files with anybody. Here is how it looks on iOS: (Android platform has a similar interface)

SA.UltimateLogger.Logger.ShowSharingUI ();

Use this API call to show only current session file content. It's very useful to view the log and find out what's happening right now. It will actually bring the same log viewer interface of a current session log file.

SA.UltimateLogger.Logger.ShowSessionLog ();

If your application has a feature for users to send you feedback or a bug report, you might want to attach the current session log to that report. Well, we've got you covered. Here is how you can get the full session log as a string:

string log = SA.UltimateLogger.Logger.GetSessionLog ();	

Note: We will record not only logs that come from Unity, but also all native plugins and services logs will be recorded to a file.

Note: On iOs platform when a debugger is connected, and you are viewing logs using the XCode console, we are not redirecting logs output to a file. Just for you to be able to read the logs from XCode console. So do not afraid if log files that were recorded during your XCode debugging session do not contain all the information you saw on the XCode console. When the device isn't connected to XCode console, we will redirect the full output to a file, so we will make sure you are not going to miss a thing.

Since we had to work with the logs output to make such API, and personally I don't really like standard unity output, we decided to tune up it a little bit. Read more about it here. And of course, you can enable/disable any logger features for any of the supported platforms, using the plugin Platforms Settings.