Skip to content

Commit

Permalink
Added Logger Debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ImMathanR committed Nov 25, 2018
1 parent bd19083 commit 511de43
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MainActivity : AppCompatActivity() {
}
})
.build()

pinsAdapter = PinsListAdapter(stocker)

pinsRV.setHasFixedSize(true)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/me/immathan/stockersample/StockerApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class StockerApp : Application() {
.redFlagPercentage(.1f) // set red indicator for 10%....different from default
.startingXPosition(600)
.startingYPosition(600)
.show(applicationContext)
//.show(applicationContext)
}

}
10 changes: 8 additions & 2 deletions stockerlib/src/main/java/me/immathan/stocker/utils/Logger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@ object Logger {
*/
private const val TAG = "STOCKER"

public var DEBUG = false

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

fun d(tag: String, msg: String) {
Log.v(getTag(tag), msg)
if(DEBUG) {
Log.v(getTag(tag), msg)
}
}

fun d(tag: String, msg: String, throwable: Throwable) {
Log.v(getTag(tag), "[ERROR] " + msg + "\nError: " + throwable.localizedMessage)
if(DEBUG) {
Log.v(getTag(tag), "[ERROR] " + msg + "\nError: " + throwable.localizedMessage)
}
}

fun e(tag: String, msg: String) {
Expand Down

0 comments on commit 511de43

Please sign in to comment.