build: Task 20 완료 - Blog 코어 이동 및 :feature:feature-torrent 모듈 분리
- core/core-common: buildConfig 활성화 및 Blog.kt를 :app에서 :core:core-common으로 이동 - feature/feature-torrent 모듈 신규 생성 (namespace: bums.lunatic.launcher.feature.torrent): * TorrentManager.kt(TorrentService, TorrentTask)를 :app에서 :feature:feature-torrent로 이동 * jlibtorrent-2.0.12.7.jar 및 ABI별 jlibtorrent-android-*.jar 5종을 feature/feature-torrent/libs/로 격리 및 api 노출 - settings.gradle.kts & app/build.gradle.kts: :feature:feature-torrent 모듈 등록 및 :app 의존성 연결 - TODO.md: 6-2(:feature:torrent 분리) 진행 내역 반영 - 검증: ./gradlew :app:compileDebugKotlin 빌드 성공 확인 (18s, 73 actionable tasks)
This commit is contained in:
@@ -11,6 +11,10 @@ android {
|
||||
minSdk = 26
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package bums.lunatic.launcher.utils
|
||||
|
||||
import android.util.Log
|
||||
import bums.lunatic.launcher.core.common.BuildConfig
|
||||
|
||||
object Blog {
|
||||
val DEFAULT_TAG = "Lunatic"
|
||||
enum class BLogType {
|
||||
D, I, E
|
||||
}
|
||||
|
||||
fun w(tag: String = DEFAULT_TAG, log: String) {
|
||||
LOG(BLogType.D, tag, log)
|
||||
}
|
||||
|
||||
fun LOGD(tag: String = DEFAULT_TAG, log: String) {
|
||||
LOG(BLogType.D, tag, log)
|
||||
}
|
||||
|
||||
fun LOGI(tag: String = DEFAULT_TAG, log: String) {
|
||||
LOG(BLogType.I, tag, log)
|
||||
}
|
||||
|
||||
fun LOGE(tag: String = DEFAULT_TAG, log: Throwable) {
|
||||
LOG(BLogType.E, tag, log.toString())
|
||||
}
|
||||
|
||||
fun LOGE(tag: String = DEFAULT_TAG, log: Exception) {
|
||||
LOG(BLogType.E, tag, log.toString())
|
||||
}
|
||||
|
||||
fun LOGE(tag: String = DEFAULT_TAG, log: String) {
|
||||
LOG(BLogType.E, tag, log)
|
||||
}
|
||||
|
||||
fun LOGE(log: String) {
|
||||
LOG(BLogType.E, DEFAULT_TAG, log)
|
||||
}
|
||||
|
||||
inline fun LOG(type: BLogType, tag: String, log: String) {
|
||||
val stackTrace = Thread.currentThread().stackTrace
|
||||
val blogIndex = stackTrace.indexOfLast { it.className.contains("Blog") }
|
||||
val callerInfo = if (blogIndex != -1 && blogIndex + 1 < stackTrace.size)
|
||||
stackTrace[blogIndex + 1]
|
||||
else null
|
||||
val fileName = callerInfo?.fileName ?: "Unknown"
|
||||
val className = callerInfo?.className ?: "Unknown"
|
||||
val methodName = callerInfo?.methodName ?: "Unknown"
|
||||
val lineNumber = callerInfo?.lineNumber ?: -1
|
||||
|
||||
if (BuildConfig.DEBUG || BuildConfig.BUILD_TYPE.contains("debug")) {
|
||||
when (type) {
|
||||
BLogType.D -> Log.d(tag, "${fileName}\n${className}\n${methodName} : ${lineNumber}\n$log")
|
||||
BLogType.I -> Log.i(tag, "${fileName}\n${className}\n${methodName} : ${lineNumber}\n$log")
|
||||
BLogType.E -> Log.e(tag, "${fileName}\n${className}\n${methodName} : ${lineNumber}\n$log")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user