Search code examples
iosswiftfirebasecrashlyticsfirebase-crash-reporting

Firebase Crashlytics Custom Log Only Log Single Line


Recently my app has been crashing while trying to deserialize the JSON sent from the server and unfortunately the server doesn't record any log so I can't verify with them. So I decided to log the JSON response for this particular Api, I know that it's a bad practice to log server response but it's the only way I could try to identify the issue, the response for this api is not that long so I think it should be fine.

The issue comes in when I tried to reveal the log and found out it only shows one line in the firebase console as below:

raw response : {

The result I was expecting were something as below,vit shows up nicely in the debug console while developing using CLSNSLogv. I thought it will be the same in firebase console too but it was not the case.

raw response : {
        success ={
            Status = OK;
            Object1 = "test"
            Object2 = "test2"
        };
    }

Below is the code for logging, "value" is a dictionary as below:

value: [String : AnyObject]?
CLSLogv("raw response : %@", getVaList([value!]))

Appreciate your help


Solution

  • You can convert the response to JSON using JSONSerialization and then remove all the carriage returns so that it's all one line. If you log that modified value it should appear correctly in the Crashlytics logs.