Logging using Crashlytics

前端 未结 5 2104

I am using multiple Crashlytics.log() commands, for example:

Crashlytics.log(\"This is message 1\");
Crashlytics.log(\"This is message 2\"); 
         


        
5条回答
  •  眼角桃花
    2021-02-19 01:03

    It seems that Crashlytics is writing the log messages asynchronously. So you will always have a race condition when using Crashlytics.log().

    Depending on what you are doing a short (and ugly) sleep before crashing may solve this issue:

    Crashlytics.log("1");
    Crashlytics.log("2");
    try {
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        // NOP: Ignored!
    }
    throw new RuntimeException("Failed directly after logging.");
    

    Or you can use custom keys instead:

    Crashlytics.setString("SOME_IMPORTANT_VALUE", "1");
    

提交回复
热议问题