Package xcrash
Class TombstoneManager
- java.lang.Object
-
- xcrash.TombstoneManager
-
public class TombstoneManager extends java.lang.ObjectTombstone (crash) log file manager.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanappendSection(java.lang.String logPath, java.lang.String key, java.lang.String content)Append a customs section (a key-content pair) to the crash log file.static booleanclearAllTombstones()Delete all Java exception, native crash and ANR log files.static booleanclearAnrTombstones()Delete all ANR log files.static booleanclearJavaTombstones()Delete all Java exception log files.static booleanclearNativeTombstones()Delete all native crash log files.static booleandeleteTombstone(java.io.File file)Delete the tombstone file.static booleandeleteTombstone(java.lang.String path)Delete the tombstone file.static java.io.File[]getAllTombstones()Get all Java exception, native crash and ANR log files.static java.io.File[]getAnrTombstones()Get all ANR log files.static java.io.File[]getJavaTombstones()Get all Java exception log files.static java.io.File[]getNativeTombstones()Get all native crash log files.static booleanisAnr(java.io.File log)Determines if the current log file recorded an ANR.static booleanisJavaCrash(java.io.File log)Determines if the current log file recorded a Java exception.static booleanisNativeCrash(java.io.File log)Determines if the current log file recorded a native crash.
-
-
-
Method Detail
-
appendSection
public static boolean appendSection(java.lang.String logPath, java.lang.String key, java.lang.String content)Append a customs section (a key-content pair) to the crash log file. After parsing the crash log file byTombstoneParser, you can retrieve the content with the key specified here.Note: This method is generally used in
ICrashCallback.onCrash(String, String).Warning: Do NOT include multiple consecutive newline characters ("\n\n") in the content string. This will break the parsing rules.
- Parameters:
logPath- Absolute path of the crash log file.key- Section key.content- Section content.- Returns:
- Return true if successful, false otherwise.
-
isJavaCrash
public static boolean isJavaCrash(java.io.File log)
Determines if the current log file recorded a Java exception.- Parameters:
log- Object of the log file.- Returns:
- Return true if YES, false otherwise.
-
isNativeCrash
public static boolean isNativeCrash(java.io.File log)
Determines if the current log file recorded a native crash.- Parameters:
log- Object of the log file.- Returns:
- Return true if YES, false otherwise.
-
isAnr
public static boolean isAnr(java.io.File log)
Determines if the current log file recorded an ANR.- Parameters:
log- Object of the log file.- Returns:
- Return true if YES, false otherwise.
-
getJavaTombstones
public static java.io.File[] getJavaTombstones()
Get all Java exception log files.- Returns:
- An array of File objects of the Java exception log files.
-
getNativeTombstones
public static java.io.File[] getNativeTombstones()
Get all native crash log files.- Returns:
- An array of File objects of the native crash log files.
-
getAnrTombstones
public static java.io.File[] getAnrTombstones()
Get all ANR log files.- Returns:
- An array of File objects of the ANR log files.
-
getAllTombstones
public static java.io.File[] getAllTombstones()
Get all Java exception, native crash and ANR log files.- Returns:
- An array of File objects of the Java exception, native crash and ANR log files.
-
deleteTombstone
public static boolean deleteTombstone(java.io.File file)
Delete the tombstone file.Note: When you use the placeholder file feature by
XCrash.InitParameters.setPlaceholderCountMax(int), please always use this method to delete tombstone files.- Parameters:
file- The tombstone file object.- Returns:
- Return true if successful, false otherwise.
-
deleteTombstone
public static boolean deleteTombstone(java.lang.String path)
Delete the tombstone file.Note: When you use the placeholder file feature by
XCrash.InitParameters.setPlaceholderCountMax(int), please always use this method to delete tombstone files.- Parameters:
path- The path of the tombstone file.- Returns:
- Return true if successful, false otherwise.
-
clearJavaTombstones
public static boolean clearJavaTombstones()
Delete all Java exception log files.- Returns:
- Return true if successful, false otherwise.
-
clearNativeTombstones
public static boolean clearNativeTombstones()
Delete all native crash log files.- Returns:
- Return true if successful, false otherwise.
-
clearAnrTombstones
public static boolean clearAnrTombstones()
Delete all ANR log files.- Returns:
- Return true if successful, false otherwise.
-
clearAllTombstones
public static boolean clearAllTombstones()
Delete all Java exception, native crash and ANR log files.- Returns:
- Return true if successful, false otherwise.
-
-