Skip to content

Commit

Permalink
[#6] 커스텀 로그 추가
Browse files Browse the repository at this point in the history
- e 로그 추가
- tag 설정 가능 함수 추가
  • Loading branch information
ethan-223 committed Mar 20, 2022
1 parent 0b35bb6 commit 4aeb725
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion app/src/main/java/com/moyerun/moyeorun_android/common/Lg.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,71 @@ object Lg {
private val tag
get() = run {
val trace = Thread.currentThread().stackTrace[4]
val tag = "${trace.fileName}:${trace.lineNumber}"
val tag = "${trace.fileName} ${trace.lineNumber}"
tag
}

fun d(msg: String) {
Log.d(tag, msg)
}

fun d(tag: String, msg: String) {
Log.d(tag, msg)
}

fun d(t: Throwable) {
Log.d(tag, Log.getStackTraceString(t))
}

fun d(tag: String, t: Throwable) {
Log.d(tag, Log.getStackTraceString(t))
}

fun w(msg: String) {
Log.w(tag, msg)
}

fun w(tag: String, msg: String) {
Log.w(tag, msg)
}

fun w(t: Throwable) {
Log.w(tag, t)
}

fun w(tag: String, t: Throwable) {
Log.w(tag, t)
}

fun i(msg: String) {
Log.i(tag, msg)
}

fun i(tag: String, msg: String) {
Log.i(tag, msg)
}

fun i(t: Throwable) {
Log.i(tag, Log.getStackTraceString(t))
}

fun i(tag: String, t: Throwable) {
Log.i(tag, Log.getStackTraceString(t))
}

fun e(msg: String) {
Log.e(tag, msg)
}

fun e(tag: String, msg: String) {
Log.e(tag, msg)
}

fun e(t: Throwable) {
Log.e(tag, Log.getStackTraceString(t))
}

fun e(tag: String, t: Throwable) {
Log.e(tag, Log.getStackTraceString(t))
}
}

0 comments on commit 4aeb725

Please sign in to comment.