Skip to content

Commit

Permalink
优化LOG
Browse files Browse the repository at this point in the history
  • Loading branch information
biezhihua committed Sep 24, 2024
1 parent 3e83fac commit d714410
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions GaiaXAndroid/src/main/kotlin/com/alibaba/gaiax/utils/Log.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ object Log {
/**
* adb shell setprop debug.com.alibaba.gaiax.log 1
*/
fun SystemProp.defaultLog(): Boolean {
return this["debug.com.alibaba.gaiax.sdk.log", "0"] == "1" || this["debug.com.alibaba.gaiax.all.log", "0"] == "1"
val defaultLog by lazy {
SystemProp["debug.com.alibaba.gaiax.sdk.log", "0"] == "1" || SystemProp["debug.com.alibaba.gaiax.all.log", "0"] == "1"
}

inline fun Log.runE(tag: String = "", block: () -> String) {
if (SystemProp.defaultLog()) {
if (defaultLog) {
runIf(ERROR, FLAG_OPEN, tag, block)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ object Log {
}
}

fun SystemProp.defaultLog(): Boolean {
return this["debug.com.alibaba.gaiax.adapter.log", "0"] == "1" || this["debug.com.alibaba.gaiax.all.log", "0"] == "1"
val defaultLog by lazy {
SystemProp["debug.com.alibaba.gaiax.adapter.log", "0"] == "1" || SystemProp["debug.com.alibaba.gaiax.all.log", "0"] == "1"
}

inline fun Log.runE(tag: String = "", block: () -> String) {
if (SystemProp.defaultLog()) {
if (defaultLog) {
runIf(ERROR, FLAG_OPEN, tag, block)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ object Log {
}
}

fun SystemProp.defaultLog(): Boolean {
return this["debug.com.alibaba.gaiax.js.log", "0"] == "1" || this["debug.com.alibaba.gaiax.all.log", "0"] == "1"
val defaultLog by lazy {
SystemProp["debug.com.alibaba.gaiax.js.log", "0"] == "1" || SystemProp["debug.com.alibaba.gaiax.all.log", "0"] == "1"
}

inline fun Log.runE(tag: String = "", block: () -> String) {
if (SystemProp.defaultLog()) {
if (defaultLog) {
runIf(ERROR, FLAG_OPEN, tag, block)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.alibaba.gaiax.js.proxy

import com.alibaba.gaiax.js.utils.Log
import com.alibaba.gaiax.js.utils.defaultLog
import java.lang.reflect.Method


Expand Down Expand Up @@ -55,12 +53,12 @@ object Log {
}
}

fun SystemProp.defaultLog(): Boolean {
return this["debug.com.alibaba.gaiax.js.proxy.log", "0"] == "1" || this["debug.com.alibaba.gaiax.all.log", "0"] == "1"
val defaultLog by lazy {
SystemProp["debug.com.alibaba.gaiax.js.proxy.log", "0"] == "1" || SystemProp["debug.com.alibaba.gaiax.all.log", "0"] == "1"
}

inline fun Log.runE(tag: String = "", block: () -> String) {
if (SystemProp.defaultLog()) {
if (defaultLog) {
runIf(ERROR, FLAG_OPEN, tag, block)
}
}
Expand Down

0 comments on commit d714410

Please sign in to comment.