refactor: update log usages
This commit is contained in:
parent
d1b7376633
commit
731329879d
3 changed files with 4 additions and 16 deletions
|
|
@ -9,12 +9,10 @@ package ua.acclorite.book_story.core.crash
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Process
|
import android.os.Process
|
||||||
import android.util.Log
|
import ua.acclorite.book_story.core.logE
|
||||||
import ua.acclorite.book_story.presentation.crash.CrashActivity
|
import ua.acclorite.book_story.presentation.crash.CrashActivity
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
private const val CRASH_TAG = "CRASH, APP"
|
|
||||||
|
|
||||||
class CrashHandler(
|
class CrashHandler(
|
||||||
private val context: Context
|
private val context: Context
|
||||||
) : Thread.UncaughtExceptionHandler {
|
) : Thread.UncaughtExceptionHandler {
|
||||||
|
|
@ -22,7 +20,7 @@ class CrashHandler(
|
||||||
override fun uncaughtException(thread: Thread, throwable: Throwable) {
|
override fun uncaughtException(thread: Thread, throwable: Throwable) {
|
||||||
val crashLog = throwable.stackTraceToString()
|
val crashLog = throwable.stackTraceToString()
|
||||||
|
|
||||||
Log.e(CRASH_TAG, crashLog)
|
logE(crashLog)
|
||||||
if (!CrashUtils.saveCrashLog(context, crashLog)) return
|
if (!CrashUtils.saveCrashLog(context, crashLog)) return
|
||||||
|
|
||||||
val intent = Intent(context, CrashActivity::class.java).apply {
|
val intent = Intent(context, CrashActivity::class.java).apply {
|
||||||
|
|
|
||||||
|
|
@ -64,13 +64,6 @@ enum class Theme(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Converting [String] into [Theme].
|
|
||||||
*/
|
|
||||||
fun String.toTheme(): Theme {
|
|
||||||
return Theme.valueOf(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a colorscheme based on [Theme].
|
* Creates a colorscheme based on [Theme].
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,10 @@
|
||||||
|
|
||||||
package ua.acclorite.book_story.ui.theme
|
package ua.acclorite.book_story.ui.theme
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import androidx.compose.material3.ColorScheme
|
import androidx.compose.material3.ColorScheme
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.toArgb
|
import androidx.compose.ui.graphics.toArgb
|
||||||
|
import ua.acclorite.book_story.core.logD
|
||||||
private const val THEME = "THEME"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function logs all the colors of the colorScheme.
|
* This function logs all the colors of the colorScheme.
|
||||||
|
|
@ -33,8 +31,7 @@ fun ColorScheme.logTheme(darkTheme: Boolean): ColorScheme {
|
||||||
return "private val $variableName$suffix = Color(0x${this.convertToHex()})\n"
|
return "private val $variableName$suffix = Color(0x${this.convertToHex()})\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.i(
|
logD(
|
||||||
THEME,
|
|
||||||
"Theme $suffix:\n" +
|
"Theme $suffix:\n" +
|
||||||
"------------------------\n" +
|
"------------------------\n" +
|
||||||
primary.convertToVal("primary") +
|
primary.convertToVal("primary") +
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue