STWLogger Helper
This class represent the Logger interface between the user main module and the Core module.
- To delegate the user logs in the Core module you can use LOGGER instance.
- To enable, disable, export, archive, get prefs or get DB file use execute method
The following example gives an idea how to use this logger :
- Delegate the logs in the SW Core :
STWLoggerHelper.LOGGER.d(Pair.create(CLASS_NAME, "methodName"), TAG, "this is a DEBUG log message"); STWLoggerHelper.LOGGER.i(Pair.create(CLASS_NAME, "methodName"), TAG, "this is an INFO log message"); STWLoggerHelper.LOGGER.w(Pair.create(CLASS_NAME, "methodName"), TAG, "this is a WARNING log message"); STWLoggerHelper.LOGGER.e(Pair.create(CLASS_NAME, "methodName"), TAG, "this is an ERROR log message"); STWLoggerHelper.LOGGER.e(Pair.create(CLASS_NAME, "methodName"), throwable, TAG, "this is an ERROR with exception log message");Content copied to clipboard - Execute command log :
STWLoggerHelper.execute(context, Command.LOG_ON, null);Content copied to clipboardSTWLoggerHelper.execute(context, Command.LOG_OFF, null);Content copied to clipboardSTWLoggerHelper.execute(context, Command.LOG_EXPORT, new STWLoggerHelper.Callback() { public void onStart() { } public void onFinish(Object data) { if (data != null) { List<Uri> list = (List<Uri>) data; if (list.isEmpty() == false) { // send report } } } });Content copied to clipboardSTWLoggerHelper.execute(context, Command.CRASH, new STWLoggerHelper.Callback() { public void onStart() { } public void onFinish(Object data) { if (data != null) { List<Uri> list = (List<Uri>) data; if (list.isEmpty() == false) { // send the crash files } } } });Content copied to clipboardSTWLoggerHelper.execute(context, Command.LOCAL_PREFS, new STWLoggerHelper.Callback() { public void onStart() { } public void onFinish(Object data) { if (data != null) { List<Uri> list = (List<Uri>) data; if (list.isEmpty() == false) { // send the prefs files } } } });Content copied to clipboardSTWLoggerHelper.execute(context, Command.LOCAL_DB, new STWLoggerHelper.Callback() { public void onStart() { } public void onFinish(Object data) { if (data != null) { List<Uri> list = (List<Uri>) data; if (list.isEmpty() == false) { // send the DB files } } } });Content copied to clipboardSTWLoggerHelper.createReport(context, comment, extraFileList, new ReportCallback() { public void onStarted() { } public void onProgress(long transferredBytes, long totalBytes) { } public void onCompleted(long totalSize) { } public void onError(boolean isInfected) { } public void onFail(String reason) { { } }); } </pre> <p> </li> </ol> </p>Content copied to clipboard
Types
Properties
Functions
Link copied to clipboard
open fun createReport( @NonNull context: Context, @Nullable comment: String, @Nullable deviceInfo: String, @Nullable extraFileList: List<Uri>, @Nullable callback: ReportCallback)
Content copied to clipboard
A public method useful when you want to export the logger zip file with comments and/or files.
Link copied to clipboard
open fun debuggableMode(@NonNull context: Context, debuggableMode: Boolean)
Content copied to clipboard
Set to true if this application would like to allow show logs in LogCat of Android Studio
Link copied to clipboard
Call this method if you want to enable/disable logs
Link copied to clipboard
open fun exportLocalDB(@NonNull context: Context, @Nullable callback: STWLoggerHelper.LoggerCallback<List<Uri>>)
Content copied to clipboard
Call this method if you want to export local data base.
Link copied to clipboard
open fun extractCrashStackTraces(@NonNull context: Context, @Nullable callback: STWLoggerHelper.LoggerCallback<List<Uri>>)
Content copied to clipboard
Call this method if you want to retrieve crash stack traces file
Link copied to clipboard
open fun extractLocalPrefs(@NonNull context: Context, @Nullable callback: STWLoggerHelper.Callback<List<Uri>>)
Content copied to clipboard
Call this method if you want to enable/disable logs
Link copied to clipboard
open fun extractLogs(@NonNull context: Context, @Nullable callback: STWLoggerHelper.LoggerCallback<List<Uri>>)
Content copied to clipboard
Call this method if you want to retrieve log files
Link copied to clipboard
Link copied to clipboard
open fun initApplicationLogLevel(@NonNull context: Context, @NonNull applicationLogLevel: LogLevel)
Content copied to clipboard
Link copied to clipboard
open fun initLogHeaderFile(@NonNull context: Context, @Nullable headerContentFile: String)
Content copied to clipboard
Header content text to be appended on top of each new log file
Link copied to clipboard
open fun initSipStackLogLevel(@NonNull context: Context, @NonNull sipLogLevel: LogLevel)
Content copied to clipboard
Link copied to clipboard
open fun initVoIPLogLevel(@NonNull context: Context, @NonNull voIPLogLevel: LogLevel)
Content copied to clipboard